Support Forum
I saw an earlier thread about using sp functions outside the forum, and it alluded to needing to include forum files, variables, etc. I'm wondering how specifically to do this.
Is there a global variable to include so that I can echo sp_UserAvatar();? Or is there a file to include that will allow me to bootstrap sf functions - something akin to including wp-load.php?
whoops. looks like we did not think that through all the way. We used to have a template tag for displaying the avatar outside the forum, but removed it in 5.0 in favor of the display template tag your referenced... problem is, as you discovered, its not available outside the forum...
you should be able to call: sp_forum_api_support()
and then it should be available... will have to consider the wrapper once again or make it more know about that function...
and for reference, you can get the details on the avatar function here: http://codex.simple-press.com/.....seravatar/
Visit Cruise Talk Central and Mr Papa's World
Yep, I did see the codex article. I couldn't glean much from it that would help me get the function working. As for now, I did try and declare the function above, but I'm still getting nothing on the page (in fact, the entire output of HTML now breaks after the functions).
I'm using this and wondering if I'm declaring the function you suggested correctly?
<div class="bio-photo" id="forum-bio-photo">
<?php
sp_forum_api_support();
echo sp_UserAvatar();
?>
</div>
Currently the page is rendering white where the php begins (it's a dev site, so I'm not terribly worried).
well, you dont want the echo... the sp_UserAvatar() function (as per the codex page) already outputs the data unless you set the echo=0 argument in which case it would be returned...
also, since you are not passing anything to the function, its assuming it will use the avatar of the currently logged in user... is that what you want?
do you have a link to this example? would like to see if any output is generated just to make sure the function is really getting called (ie not missing an include file)...
if you want it for a specific user vs current logged in user, you would do something like
<?php sp_forum_api_support(); sp_UserAvatar('context=user', $user); ?>
where $user is the user id or user email address that you want the avatar for...
Visit Cruise Talk Central and Mr Papa's World
You guys are awesome. The ahah_support function with the avatar works perfectly to display on non-forum pages. I used just the sp_UserAvatar() to display the currently logged-in user's avatar. Works brilliantly!
I just sent a PM to you both to provide access to the forum to view. Many thanks for the help.
1 Guest(s)