Log in

View Full Version : How do i check if the user is part of a group


iadmirevb
04-02-2009, 02:52 PM
Hello,
I've created a forum and inside the description i added a html code that embed a flash palyer. The code works great!

<div style="border:0px solid red;margin-top:5px;">
<embed
src="/flv_mediaplayer44/player.swf"
width="350"
height="20"
bgcolor="#E1E4F2"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="file=/media/fileoftheweek_indi.mp3"
/>
</div>

I want to take it one step higher and i want to add a code that checks if the user is part of the registered group. If he is, then i show the code for the flash player.

Is this feasable?

Thanks
Marco

Lynne
04-02-2009, 03:15 PM
Well, the code for checking for usergroups would be either:
In a template:
<if condition="is_member_of($bbuserinfo, x,y,z)">

In php:
if (is_member_of($vbulletin->userinfo, x,y,z))


I have no idea if that will work in your description. If not, you'll have to edit your templates to use the condition.

TigerC10
04-02-2009, 03:16 PM
You did this in a template?

You could always stick that code in a template conditional...


<if condition="$bbuserinfo[userid] != 0">
<div style="border:0px solid red;margin-top:5px;">
<embed src="/flv_mediaplayer44/player.swf"
width="350"
height="20"
bgcolor="#E1E4F2"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="file=/media/fileoftheweek_indi.mp3" />
</div>
<else />
You must register to view the video.
</if>


If you want to make it a specific group, or set of groups, it'll get a little more complicated... Just a tiny bit.

iadmirevb
04-02-2009, 04:26 PM
no, not on a template... directly on my forum description (check image)... it's working perfectly and the users are very happy....

i think condition don't work in forum descriptions...i'm not sure about php , if i only know how to put php in html.... any ideas?

i'll keep doing some research. If nothing comes out, i guess i'll have to modified the template...

thanks again

Lynne
04-02-2009, 05:32 PM
If the condition doesn't work in the description (and I would guess it doesn't), then you will have to do some sort of template edit or maybe a plugin.