Support Forum

Last post avatar

RA Raven
Raven
Member

hi everyone!

just wanted to say awesome forum architecture software. I am really digging the infrastructure of simplepress and how it integrates with wordpress! I was wondering if there was a last poster avatar plugin or template modification to show a member’s avatar next to the last post info on the forum view index?

Thanks in advance for any help. Keep up the outstanding work!

16 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Thank you – glad you are liking it…

Can you perhaps put a bit more flesh on what you are asking for as I am not totally following the where and what you want…

RA Raven
Raven
Member
Avatar on forum index

Something like this when a member make a post and it shows up on the forum index.

MP Mr Papa
Mr Papa
Member

you can already do this…  your sp theme displays the elements… you just need to add a template tag to display the avatar…

something like:

sp_UserAvatar('tagClass=spPostUserAvatar spCenter&context=user&size=50', $spThisTopic->last_user_id);

In the default theme, you would add it to this stuff

                                sp_ColumnStart('tagClass=spColumnSection spRight&width=14%&height=50px');
                                    sp_TopicIndexPostCount('tagClass=spInRowCount', __sp('Posts'), __sp('Post'));
                                    sp_TopicIndexViewCount('tagClass=spInRowCount', __sp('Views'), __sp('View'));
                                    sp_TopicIndexStatusIcons('tagClass=spStatusIcon spCenter', __sp('This topic is locked'), __sp('This topic is pinned'), __sp('This topic has unread posts'), __sp('No permission to create posts'));
                                    if (function_exists('sp_TopicIndexRating')) sp_TopicIndexRating('tagClass=spTopicRating spCenter');
                                sp_ColumnEnd();

style as desired… change size if you want…

as always, we strongly urge you to create a child theme or make your own theme before editing to keep from losing changes on updates…

RA Raven
Raven
Member

Okay i took some screenshots and did an image edit to place the user’s avatar on where i am trying to style it into the template.

forumindex.png

 

Mr Papa said
you can already do this…  your sp theme displays the elements… you just need to add a template tag to display the avatar…

something like:

<br />

sp_UserAvatar('tagClass=spPostUserAvatar spCenter&context=user&size=50', $spThisTopic->last_user_id);

<br />

In the default theme, you would add it to this stuff

<br />

                                sp_ColumnStart('tagClass=spColumnSection spRight&width=14%&height=50px');
                                    sp_TopicIndexPostCount('tagClass=spInRowCount', __sp('Posts'), __sp('Post'));
                                    sp_TopicIndexViewCount('tagClass=spInRowCount', __sp('Views'), __sp('View'));
                                    sp_TopicIndexStatusIcons('tagClass=spStatusIcon spCenter', __sp('This topic is locked'), __sp('This topic is pinned'), __sp('This topic has unread posts'), __sp('No permission to create posts'));
                                    if (function_exists('sp_TopicIndexRating')) sp_TopicIndexRating('tagClass=spTopicRating spCenter');
                                sp_ColumnEnd();

<br />

style as desired… change size if you want…

as always, we strongly urge you to create a child theme or make your own theme before editing to keep from losing changes on updates…

By using the code you gave me above this is what i got in picture below.

spforumview.png

This is where the avatar shows on the forum in picture below….

 

forumpost.png

So anyways I am still trying to place the user’s avatar on the first example picture i did by using picture editing software. I will try placing the code again in other templates to see what happens. thanks for your help @mr-papa 

YS Yellow Swordfish
Yellow Swordfish
Member

For your first mock-up you will need to add the code to the spGroupView.php template. Get it in there roughly as you want and then we can hone it with a bit of ptoper styling when we see it. Does that make sense?

Look for the call to sp_ForumIndexLastPost() which is the column you will want it in. 

YS Yellow Swordfish
Yellow Swordfish
Member

Also – i would change that spCenter in the avatar call to spLeft.

RA Raven
Raven
Member

Yellow Swordfish said
For your first mock-up you will need to add the code to the spGroupView.php template. Get it in there roughly as you want and then we can hone it with a bit of ptoper styling when we see it. Does that make sense?

Look for the call to sp_ForumIndexLastPost() which is the column you will want it in. 

Yes sir thank you! I will start now and then take another screenshot.

RA Raven
Raven
Member

Okay here are some examples again:

spGroupView.php template.edit picture

22.png

Then this is where the code styles at but now its a guest avatar?

12.png
YS Yellow Swordfish
Yellow Swordfish
Member

Sorry – forgot about that!

Instead of:

$spThisTopic->last_user_id

you will need:

$spThisForum-<user_id

We can also stop it appearing when there are no topics and help with the styling. I need to go out for half an hour but will come back on those issues as soon as I can.

RA Raven
Raven
Member

Okay take your time no rush. I also will need a custom forum design created to match my main wordpress site. So i will give some examples for that. Thanks for your help.

RA Raven
Raven
Member

@mr-papa 

@yellow-swordfish 

 

Okay here is what I did so far, and im happy on the outcome! Thanks for your help & time guys!

Template edit in sp.GroupView.php

sp_UserAvatar(‘tagClass=spPostUserAvatar spCenter&context=user&size=25’,
$spThisForum->user_id);

example picture here

groupview.png

 

Then this is the outcome of the avatar placement:

forumindex2.png
YS Yellow Swordfish
Yellow Swordfish
Member

If you want to avoid showing an avatar on forums with no topics then this should work:

if ( $spThisForum->post_count == true ) {
    sp_UserAvatar( ‘tagClass=spPostUserAvatar spCenter&context=user&size=25′, $spThisForum->user_id );
}

And if you are happy with them centred and the way they look now then great.

I will get Ike to contact you regarding theme customisation later today.