vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Need a quick snippet of code for user permissions (https://vborg.vbsupport.ru/showthread.php?t=103537)

Club3G 12-22-2005 05:15 PM

Need a quick snippet of code for user permissions
 
I'm looking to add a navbar link for only certain usergroups, basically only have the text show up if the user is in group 1, 2 or 3. Should be pretty straight forward, but I don't see any bits of code I can swipe that look familiar enough to work. :D

Any insight would be awesome - thanks!

Update #1:

I found this while searching around, but it's not working.

Code:

<if condition="!is_member_of($bbuserinfo, 6)">
Custom Text
</if>

Usergroup 6 is Admin (me) but I'm still not seeing the text, and even then I'm not sure how to set it for more than one usergroup. What I have on my site is an image uploader script that's separate from vBulletin altogether - I'm just trying to create a navbar link that only shows up for myself and my mods.

Got it to work for single usergroups using this:
Code:

<if condition="$bbuserinfo['usergroupid'] == '6'">
Text, etc
</if>

Just not sure on how to format the "or usergroup == '5'" conditionals.

Adrian Schneider 12-22-2005 05:50 PM

Code:

<if condition="is_member_of($bbuserinfo, X) OR is_member_of($bbuserinfo, Y) OR is_member_of($bbuserinfo, Z)">Show to groups X Y and Z</if>
or for primary groups only

Code:

<if condition="in_array($bbuserinfo['usergroupid'], array(X, Y, Z))">show to groups Z Y and Z</if>

Club3G 12-22-2005 05:55 PM

That did it - Thank you very much!


All times are GMT. The time now is 02:38 AM.

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.00933 seconds
  • Memory Usage 1,709KB
  • 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
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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