View Full Version : Usergroup based content
G_Gekko
09-01-2008, 05:57 AM
I want show content for a specific usergroup only. How do I do this. would adding
if ($vbulletin->userinfo['usergroupid'] == '6' )
{
echo "This is only visible to people in usergroup 6";}
in the template where I want the info to be shown work?
Marco van Herwaarden
09-01-2008, 06:18 AM
You can not use PHP in templates (HTML only).
But you can use a conditional:
<if condition="is_member_of($bbuserinfo,x)">
Stuff for members of usergroup x
</if>
G_Gekko
09-01-2008, 07:14 AM
So I simply replace the x with the usergroup #?
What if I want an else statement ?
Marco van Herwaarden
09-01-2008, 07:18 AM
Yes the x should be replaced by the usergroupid.
You can add a <else />.
Opserty
09-01-2008, 08:08 AM
<a href="http://www.vbulletin.com/docs/html/main/template_conditionals" target="_blank">Template Conditionals</a>
G_Gekko
09-01-2008, 12:05 PM
Thanks for the link and the help.
One more question. Is it possible to get the content in
<if condition="is_member_of($bbuserinfo,x)">
Stuff for members of usergroup x
</if>
To be shown to the user only once a day
Opserty
09-01-2008, 01:33 PM
Anything is possible, it could be done. But would probably require a lot more work then a template edit, the exact nature of which I'm not sure.
G_Gekko
09-01-2008, 02:11 PM
Ok. In that case. Is there a way I can show the content on the index page only by editing the template.
PS thanks to both of you for helping me.
Opserty
09-01-2008, 03:02 PM
Have you looked into maybe using the "Notices (http://www.vbulletin.com/docs/html/notices)" feature?
G_Gekko
09-01-2008, 03:49 PM
Yes but it doesn´t do what I want.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.