vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Showing graphic if user=whatever (https://vborg.vbsupport.ru/showthread.php?t=295608)

Jon12345 02-28-2013 05:09 PM

Showing graphic if user=whatever
 
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:

Code:

<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:
Code:

...
<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.


All times are GMT. The time now is 04:59 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01022 seconds
  • Memory Usage 1,723KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete