View Full Version : non vb page wit vb permissions
PuntoPower
12-27-2005, 06:06 PM
i have a non vb page that i only want registered users to see. how can i do this?
many thanks
Michael Morris
12-27-2005, 06:34 PM
A quick search for vb powered pages should turn up more precise info on this, but in brief you'd need to include the global.php file of vbulletin to initialize the vb engine. Once that's done the rest of your file can run a permissions check. How this is done though varies significantly between vb 3.0.x and 3.5.x and I'm not familiar with the process under vb 3.5.x
gizmo4321
12-27-2005, 07:13 PM
If you want to do it based on groups, then something like this should work; I use it myself:
define ("FORUM_HOME_DIR", "WhereverForumHomeIs");
define("MY_APP_HOME_DIR", "WhereverMyAppHomeIs");
define("REGISTERED_USER_GROUP", "RegisteredGroupId");
chdir(FORUM_HOME_DIR);
include_once('./global.php');
include_once('./includes/functions.php');
chdir(MY_APP_HOME_DIR);
if(is_member_of($vbulletin->userinfo, REGISTERED_USER_GROUP))
{
Do registered stuff here;
}
else
{
Do not registered stuff here;
}
The above code is for vB 3.5.x
For vB 3.0.x you would change $vBulletin->userinfo to $bbuserinfo.
Hope this helps.
PuntoPower
12-27-2005, 08:02 PM
after a bit of trying a few things i have made a non vb page that calls a custome made templete in vb. this templete calls the header and footer and in the middle has the following
<p align=center>
<iframe src="http://www.mywebsite.com/chat/chat/index.php3" style="height:500px;width:800px;"></iframe>
</p>
what variables are used to make a if statment so i can set what groups can see this iframe?
thx
gizmo4321
12-27-2005, 08:07 PM
The Display Group Id will be $vBulletin->userinfo['usergroupid'].
The Group Membership list will be $vBulletin->userinfo['membergroupids'], and will be a comma delimited string of all groups the user is a member of.
Would it not be easier just to go into your Admin Control Panel, go to the group settings, and see what group id the group you're interested in has? (Sorry, I'm beginning to think I may not be fully understanding what you are trying to do?)
PuntoPower
12-27-2005, 08:18 PM
sry if im not been clear. this non vb page is a chatroom so i dont want non registered users to see it. so was wondering can someone put an if statment together that i will put in the templete so that if a non registered member views the page they get a message sayin that they need to register to view the page, but if they have registered the iframe code is called and they see the chat room
hope that helps
usergroups that i want to see the chatroom code are 2,3,5, 6, 9, 11
citricguy
12-27-2005, 08:58 PM
I use this $5 script called FlashChat for my site. It integrates with vBulletin very well and already has everything you need.
check out http://www.tufat.com/s_flash_chat_chatroom.htm
PuntoPower
12-27-2005, 09:06 PM
ive tried flashchat already but my members prefer phpmychat. thx tho
gizmo4321
12-27-2005, 09:41 PM
I think I'm beginning to understand.
The code I gave you only works if they are currently logged into vBulletin. Then, when they go to your non-vB page, you can check to see if they are real users or not.
However, if I understand this aright, what you want is to know if they are registered users in your forum without actually having them login to it, right?
PuntoPower
12-27-2005, 10:01 PM
I think I'm beginning to understand.
The code I gave you only works if they are currently logged into vBulletin. Then, when they go to your non-vB page, you can check to see if they are real users or not.
However, if I understand this aright, what you want is to know if they are registered users in your forum without actually having them login to it, right?
you are right the first time but that code doesnt work in templetes, "if" statements have to be done like below
<if condition=" user a member of either of the following groups 2,3,5, 6, 9, 11 " >
show chat room in iframe
else
dont show chatroom in iframe
</if>
gizmo4321
12-28-2005, 12:00 AM
The code wasn't intended to work in a template; it was intended to work in an independent PHP-rendered page.
You are getting into uncharted territory for me here; I <THINK> what you need to do is write a PHP-based plugin that sets a global var that you can then evaluate in the template. The plugin would look similar to the code I gave you earlier, except it wouldn't need the includes.
if(is_member_of($vbulletin->userinfo, REGISTERED_USER_GROUP))
$m_IsRegisteredUser = TRUE;
else
$m_IsRegisteredUser = FALSE;
Then, in your template code, you would have this:
<if condition="$m_IsRegisteredUser">
Do Registered User Stuff
<else>
Do Non-Registered User stuff
</if>
Now, I haven't got the foggiest idea if this will actually do what you want, but it might be worth a shot.
PuntoPower
12-28-2005, 09:40 AM
think i got it
<if condition="is_member_of($bbuserinfo[usergroupid], array(2,3,5,6,9))">
do this
<else />
do that
</if>
one thing that confuses me is that im using vb350 and i taught vb350 uses userinfo and not bbuserinfo but when i tried bbuserinfo it didnt work!!!
gizmo4321
12-28-2005, 01:34 PM
Did that work? I didn't think you could call functions from within the conditionals?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.