Support Forum

Modify Last Post Section in Group View

21 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Well you needs to test it. If the $user_id == 0 then don’t display anything

MO Moggle
Moggle
Member

I’ve managed to get this working so thought I would post the code so other people can use it:

This is what I used:

if ($spThisForum->user_id == 0):
echo ”;
else:
sp_UserAvatar(‘tagClass=spAvatarGroup spLeft&size=30&link=none&context=user’, $spThisForum->user_id);
endif;
YS Yellow Swordfish
Yellow Swordfish
Member

That’s great. You could simplify this even further and remove the empty echo statement by using a not equals instead of an equals:

if ($spThisForum->user_id != 0) sp_UserAvatar('tagClass=spAvatarGroup spLeft&size=30&link=none&context=user', $spThisForum->user_id);

which will do the same thing.

MO Moggle
Moggle
Member

One more thing about Avatars, I promise! How would you display it in the ListView section? I’ve tried $ThisForum and $ThisTopic but it does not display them. I’ve even tried $spThisList->last_user_id but to no avail.

EDIT: nevermind as i got it working with $spThisListTopic->user_id