Log in

View Full Version : Showing graphic if user=whatever


Jon12345
02-28-2013, 05:09 PM
I have set up different membership levels on my forum. If someone gets to a more advanced membership level, they get added to an additional usergroup.

Is there any code that I can do that will show me a gif but only if they are a member of a certain group? It could be one of 4 different groups and the gif would change depending on which group they are in.

Thanks,

Jon

darnoldy
02-28-2013, 06:01 PM
Jon-

I believe you can set an image to be displayed based on a user's usergroup using the "Ranks" system in the Admin control panel—I don't use ranks, so I can't give you specific instructions.

The thing that I am confused about from your post is, do you want these only to appear for you (the admin) or for everyone to see them?

-don

Jon12345
02-28-2013, 06:39 PM
The images are for everybody to see. The idea is that it will be a plaque showing the user level. So, in a typical thread, the first post might have, in the left column below where it says "Newly Registered User", an image saying Basic User. The next post in that thread might have something similar but with an image saying VIP Member, and so on.

These are basically plaques in the same area where the Avatars are, but showing user level.

Anyone know how?

kh99
03-01-2013, 09:44 PM
In a template you can use something like:

<vb:if condition="is_member_of($bbuserinfo, 4)">
<img src="group4.gif">
<vb:elseif condition="is_member_of($bbuserinfo, 5)" />
<img src="group5.gif">
<vb:elseif condition="is_member_of($bbuserinfo, 6)" />
<img src="group6.gif">
</vb:if>


and of course you can extend that to as many as you want.

And if you only want to specify a special image for certain groups, you could have a "catch-all" by ending with an "else", like:
...
<vb:elseif condition="is_member_of($bbuserinfo, 6)" />
<img src="group6.gif">
<vb:else />
<img src="others.gif">
</vb:if>

Jon12345
03-04-2013, 11:13 AM
Thank you for your reply, although I think there has been a misunderstanding.

Essentially, I want this in a thread:

Post #1
User: Dave12345, Level: Basic Member. Therefore, show "Basic Member" image badge below his name.
Post #2
User: Jon-Doe, Level: Paid Member. Therefore, show "Paid Member" image badge below his name.
Post #3
User: JulieB, Level: Basic Member. Therefore, show "Basic Member" image badge below his name.
Post #4
User: MarkStone, Level: Administrator. Therefore, show "Administrator" image badge below his name.

Is that a bit clearer? Is this possible?

(You code helped me with something else I wanted to do though. :))

kh99
03-05-2013, 12:19 PM
I think that code will work, but to use it in the postbit template you'd want to change $bbuserinfo to $post.

Jon12345
03-06-2013, 10:20 PM
Yes, you are right. Thanks for that distinction. Working now.

squidsk
03-07-2013, 03:10 PM
I'd still think you'd want to do this through the ranks system, where each usergroup has its own images. This would allow for the images, but not require any custom code to be added, unless I'm missing something with what you are hoping to achieve as the built in ranks system would seem to offer what you're after.