Notifications
Clear all

Style [Solved] Show Likers with their avatar

8 Posts
3 Users
4 Likes
502 Views
Tutrix
Posts: 826
Topic starter
(@tutrix)
Noble Member
Joined: 3 years ago

Hi,

i have mudified the mentioned members and the likers (in a separate line) so that the avatar is also shown.

everything works fine for the members mentioned

but the Likers only avatars are displayed that were uploaded via the upload function of wpForo
Gravatars or Letters Avatar (plugin) are not displayed

example post

i use this code for the likers, adjusted to the number of likers [0][1][2]

' . esc_url(WPF()->member->get_avatar_url($l_usernames[0]['ID'])) . '

can someone give me the correct code that all avatars are displayed 😉 

Topic Tags
7 Replies
Chris
Posts: 2369
Admin
(@chris)
Support Team
Joined: 1 year ago

Hi @tutrix,

Try this methods in Members Class

WPF()->member->get_avatar()

or

WPF()->member->avatar()
Reply
1 Reply
Tutrix
(@tutrix)
Joined: 3 years ago

Noble Member
Posts: 826

Hi @chris 

thanks for your help
but what do you mean by "members class"?

my complete avatar code above currently looks like this

first liker

<span class="nickname-ava"><img src="' .esc_url(WPF()->member->get_avatar_url($l_usernames[0]['ID'])) . '"/></span>

second liker

<span class="nickname-ava"><img src="' .esc_url(WPF()->member->get_avatar_url($l_usernames[1]['ID'])) . '"/></span>

etc.

have now tested different versions with your code, but always gives an error 😉 

 

for the mentioned members I use this code

<span class="nickname-ava">' . WPF()->member->avatar( $member ).' </span>

but it does not work for the Likers

Reply
fawp
Posts: 153
 fawp
(@fawp)
Estimable Member
Joined: 3 years ago
Posted by: @tutrix

have now tested different versions with your code, but always gives an error

What error are you getting?

Reply
1 Reply
Tutrix
(@tutrix)
Joined: 3 years ago

Noble Member
Posts: 826

@fawp 

  • a half crashed forum
  • a fully crashed forum
  • syntax error if I forget a character 😀 
  • an empty image path like the code used so far

    if you know the right code, just post it 😉 

Reply
fawp
Posts: 153
 fawp
(@fawp)
Estimable Member
Joined: 3 years ago
Posted by: @tutrix

if you know the right code, just post it

No, I don't use any such function. The reason I asked is I thought you were getting a php error which might have been helpful to wpForo support, but it seems you are not getting those.

Reply
1 Reply
Tutrix
(@tutrix)
Joined: 3 years ago

Noble Member
Posts: 826

@fawp 

ok, thanks for trying to help

Reply
Tutrix
Posts: 826
Topic starter
(@tutrix)
Noble Member
Joined: 3 years ago

Have now found the correct code 😀 

are these 3 lines for the 3 displayed Likers

<span class="nickname-ava">' .WPF()->member->get_avatar($l_usernames[0]['ID']). '</span>
<span class="nickname-ava">' .WPF()->member->get_avatar($l_usernames[1]['ID']). '</span>
<span class="nickname-ava">' .WPF()->member->get_avatar($l_usernames[2]['ID']). '</span>
Reply