Support Forum

Template Tags Error

ST sterling
sterling
Member

I installed template tag plugin on 5.0.5.  When I try to add a template tag I get error that function is not found.  Am I using it wrong?

Example: <?php sp_ProfileShowDisplayName(); ?>

17 Answers

New Answer

MP Mr Papa
Mr Papa
Member

sorry, what are you trying to do?  that function call is not part of the template tags plugin…  that is part of a profile…

so please explain what you would like to do and we can help…

ST sterling
sterling
Member

I’m trying to display the user’s name in a welcome bar.  I used to have it working with older version.

I found the function under Display Template Tags. 

http://codex.simple-press.com/codex/api/functions-and-tags/display-template-tags/profile-view/ 

MP Mr Papa
Mr Papa
Member

is the welcome bar on an SP page or other WP page?  If SP, specific page or any page?

Try this: 

echo $spThisUser->display_name;

ST sterling
sterling
Member

Thanks for reply.  It’s on another WP page.  That’s why I was looking up the Display Template Tags.  

Is that section in codex incorrect?  Or am I just misunderstanding it?

MP Mr Papa
Mr Papa
Member

did my suggestion work?

you read it half right and half wrong. wink  the tag is right, but it was in a profile view section… that means it works on profile pages…  you need it on all pages…  and actually, all the sp display template tags are for on sp pages…

if it did not work, being on another wp page, try:

global $spThisUser;
sp_forum_api_support();
echo $spThisUser->display_name;
ST sterling
sterling
Member

Ah, I see.  It’s only for SP themes.  Not general WP template tag.

I used to be able to use template tags in other pages like sf_show_avatar(40);  How do we do that with 5.x?

Thank you! 

ST sterling
sterling
Member

We posted at same time kiss.  Thanks for info, will try that.

Where can I find available methods for $spThisUser?

ST sterling
sterling
Member

That works, thanks.  I used to also display PM count in WP template.

sf_pm_tag($display=true, $usersonly=false); 

How best to do that now?

MP Mr Papa
Mr Papa
Member

no methods for $spThisUser… its a data object…

but go to forum – toolbox – data inspector…  and turn on the display of spThisUser… will show you (on front end) whats available… similarily, you can look at other global objects on the various page views…  now if you call the sp_forum_api_support() that sets up the $spThisUser variable (you do have to do the global declaration) on non forum pages…

so… now you gonna make a liar out of me, huh? winkembarassed but a couple of the common display tags, such as sp_UserAvatar(), are available outside of SP pages… but you have to provide the data to them, ie with the $spThisUser global variable or other user object…

MP Mr Papa
Mr Papa
Member

as to pm… do you have the pm plugin installed?

until we get the codex fully populated, always best to look at the code…  the template tag for the pm tag is in the pm plugin…

sp_pm_inbox()

should work for you based on your above…

ST sterling
sterling
Member

inbox template tag worked great.  Thanks.  Any chance of a avatar tag?  Used to use sf_show_avatar(40);

Last tag, I promise 🙂

MP Mr Papa
Mr Papa
Member

lol, thought I already told you that one in post #10…

but this:

global $spThisUser;
sp_forum_api_support();
sp_UserAvatar();
MP Mr Papa
Mr Papa
Member

whoops… forgot about your size..

global $spThisUser;
sp_forum_api_support();
sp_UserAvatar('size=40');
ST sterling
sterling
Member

Ah, you did in post #10.  You must have had a premonition I’d be needing it, too bad I didn’t read your example more carefully 🙂

Thanks for all of your help sir!