Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Show Forum Avatar
Avatar
puttee
Member
Free Members
sp_UserOfflineSmall Offline
Feb 19, 2012 - 11:07 am

Since simple press v5.0 the function sf_show_forum_avatar();  doesnt work anymore. 

I used this function in my theme function.php to diplay the avatar next to the comment text in the wordpress front end.

e.g.: sf_show_forum_avatar($comment->comment_author_email); 

Is there a new function to fix?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Feb 19, 2012 - 11:14 am

sp_UserAvatar(); is what you want...

see wp-content/simple-press/forum/content/sp-common-view-functions.php for all the details and arguments you can pass to the function.

but basically, you want:

sp_UserAvatar($args, $comment);

at a minimum, you will want to pass context=user in the args... ie

sp_UserAvatar('context=user', $comment);

of course, you can add more args if you want to change more from defaults...

Avatar
puttee
Member
Free Members
sp_UserOfflineSmall Offline
Feb 20, 2012 - 4:56 am

Mh, I use the following code atm: 

<?php sp_UserAvatar('context=user&size=40&imgClass=spAvatar', $comment); ?>

But, not the user/member specific avatar is shown in the comments-list:

http://www.miranda-fusion.de/s.....press2.jpg

Any ideas?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 20, 2012 - 10:23 am

on the profiles > avatars admin panel, do you have the option set to 'replace WP avatar...'?

andy-signature.png
YELLOW
SWORDFISH
Avatar
puttee
Member
Free Members
sp_UserOfflineSmall Offline
Feb 20, 2012 - 11:05 am

I tried both options. But still the same problem. 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Feb 20, 2012 - 7:24 pm

a bit confused... are you talking about two separate things?

showing an avatar someplace and then having avatars in comments replaced?  cause that is two different things...

if all you want to do is show sp avatars in place of wp avatars, then just do like andy said in post 4... you dont need a template tag...  you 'might' be creating circular reference of sorts...  but not sure exactly what you are doing...

Avatar
puttee
Member
Free Members
sp_UserOfflineSmall Offline
Feb 23, 2012 - 3:46 am

Well, I tried to explain into more detail:

I would like to have an avatar in front of each comment in the comments-list of wordpress (not the forum). An individually avatar should be shown, if a comment was written by a still exisiting user (means: registered in my blog and the simple press forum). If a guest (not registered) write a comment to a thread of my blog, a default avatar should be shown next to his name in the comments-list.

Therefore I used this funtion: 

sp_UserAvatar('context=user&size=40&imgClass=spAvatar', $comment);

Edit: Now I found my mistake. I extended the function like the following:  

sp_UserAvatar('context=user&size=40&imgClass=spAvatar', $comment->comment_author_email);

The result looks like this, like it should:

http://www.miranda-fusion.de/s.....press3.jpg

 

This function works now for comments in articles, BUT not in the comments-list of pages. It gives me an error:

Fatal error: Call to undefined function sp_UserAvatar() in the function.php.

But works for articles. Maybe you have an explanation for that. Why is this function not working on static pages?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 23, 2012 - 5:36 am

This is because we do not load forum code where it is not necessary - which is good practice. Not sure if this will work but initially try calling this function before the avatar call:

sp_forum_ahah_support();

see if that helps.

andy-signature.png
YELLOW
SWORDFISH
Avatar
puttee
Member
Free Members
sp_UserOfflineSmall Offline
Feb 23, 2012 - 5:54 am

Great, superb... it works like a charm now.

Thanks for all your help.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 23, 2012 - 7:59 am

you're welcome

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625