The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
How to restrict usergroups from using certain functionality?
It is possible to restrict viewing of certain (template) functions to member groups of choice, by using this conditional:
<if condition="is_member_of($bbuserinfo,4,5,6,7)">[insert code that you want to restrict]</if> 4,5,6,7 are the user groups and can be replaced for any other user group. This way you can for instance restrict all members, except those in usergroups 4,5,6 and 7 to see videos on profiles. However, this way of restricting functions for visitors of the page is often confused with restricting functions for the member the function relates to. i.e. the member who's profile, post is concerned. If you have a function on profiles or posts that you want to restrict to certain usergroups, then how do you handle that? For example: You want only users within usergroup 11and 12 to be able to show a video on their profile. What conditional code can you use to accomplish this? Should MEMBERINFO be modified for this or is there a more backend way of doing this? |
#2
|
||||
|
||||
With a big thanks to Digital Jedi:
<if condition="in_array($post['usergroupid'], array(4,5,6,7))">[insert code that you want to restrict]</if> Only 4,5,6 and 7 will be able to use the functionality. |
#3
|
|||
|
|||
the recommened way of doing things is using is_member_of() as it checks additional usergroups and also means that your code won't break if vBulletin change the usergroupid column name (obviously they really wouldn't but it is just an example of how it could break).
I didn't understand what half of your post said though. $post is used in the postbit(_legacy) template so it won't have any effect in the MEMBERINFO template. $userinfo or $prepared (3.6/3.7 respectively) are the variables in use in the MEMBERINFO template. $bbuserinfo is the variable for the user that is currently browsing the page. |
#4
|
||||
|
||||
Could you give me examples of how you would restrict a function on postbit and on MEMBERINFO? I am not certain of the syntax when using is_member_of().
|
#5
|
|||
|
|||
You've given the correct usage in your first post.
|
#6
|
||||
|
||||
Oh wow. I totally looked over that.
What are the variables for memberlist, groups, Blog and forum leaders? |
#7
|
|||
|
|||
Quote:
|
#8
|
||||
|
||||
I dont think so. I checked before and after adding this.
|
#9
|
|||
|
|||
Edit:
Oh no Im thinking of the can_moderate function. |
#10
|
||||
|
||||
I tried to apply this code to newpost_usernamecode in order to add user group permissions to Anonymous posting
I tried adding the red section: -------------- <if condition="$show['anonymous'] AND is_member_of($post,4,5,6,7)"><div><input type="checkbox" id="cb_anonymous" class="bginput" name="anonymous" value="1" <if condition="$vbulletin->GPC['anonymous']">checked="checked"</if>/>$vbphrase[zointsanony_anonymous_post]</div></if> -------------- Do you have any idea? |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|