View Full Version : How can I restrict access by usergroup?
I have a login hack for my DigiChat room, and it works great. Unfortunately, it also allows users awaiting email confirmation to still access the chat. Therefore, people can get in without even providing a valid email.
So, I'd like to know if there is a way to restrict access to only members in the Registered usergroup? At this point, I have my 'awaiting email confirmation' usergroup set up to not allow access to the forum at all, preventing them from getting in the chat. But I really don't want that as a permanent option. Can I add a usergroup variable to this and if so, what should it be?
Here is my code:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Thanks :)
JamesUS
13 Jun 2001, 15:32
Add the variable "usergroupid" to the select statement:
SELECT username, usergroupid...
I believe the ID of the group that is awaiting email confirmation is "3" but I'd need to check.
Post back if you need example code.
Thank you! And yes, example code would be appreciated.
:)
Freddie Bingham
13 Jun 2001, 15:36
It appears your code is for vb 1.1.x but if you want to do something with 2.0, this sort of thing would get you where you want to go:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
okay that code works okay for digichat, but i get this error:
Parse error: parse error in e:\inetpub\wwwroot\vb\chat2.php(7) : eval()'d code on line 27
im using vb2.0 help me plz
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
k it works... here is the full code i use to incorporate digichat 3.5 into vbulletin 2.0
<?php
include("./global.php");
if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==3) {
show_nopermission();
}
eval("dooutput(\"".gettemplate("chat")."\");");
if( $bbuserid ) {
$user = $DB_site->query_first( "SELECT username
FROM user
WHERE userid = $bbuserid" );
$bbuserinfo = $user[ username ];
print( "<APPLET align=middle code=\"com.diginet.digichat.client.DigiChatApplet\"
codeBase=\"http://www.blah.com/DigiChat/DigiClasses/\"
width=\"200\" height=\"100\" align=\"middle\" ARCHIVE=\"client.jar\" nickname=\"$username\">
<PARAM NAME=\"siteID\" VALUE=\"1000\">
<PARAM NAME=\"cabbase\" VALUE=\"Client.cab\">
<PARAM NAME=\"background\" VALUE=\"000000\">
<PARAM NAME=\"textcolor\" VALUE=\"ffffff\">
<param name=\"floodControl\" value=\"1000\">
<PARAM NAME=\"nickname\" VALUE=\"$bbuserinfo\">
<PARAM NAME=\"openProfileURL\" VALUE=\"true\">
<PARAM NAME=\"room\" VALUE=\"chat-room-name\">
Our Chat requires a Java Compatible web browser to run.
</APPLET>\n" );
} else {
print( "<BODY BGCOLOR=\"#000000\">
<CENTER>
<FONT FACE=\"verdana, arial\" size=\"2\" color=\"white\">
Sorry, you must be logged into the Forum to use Chat!</font><br>" );
} // end if
it still needs a lil cleanin up... cause it displays the connect string all weird on the page, etc... can it like close the old window when a person clicks on chat?
it keeps bringin up a window saying the siteid you entered is invalid yet it still works... why is that? but sometimes my users can't get on... hrmm
can someone plz post a complete working hack for digichat 3.5 to work with vbulletin 2.0... complete with the chat.php and the templates that you're suppose to add...
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
chat template:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Remove the spaces for the replacement variables in red above, and insert the correct values that are in blue.
Mark4444
28 Jun 2001, 18:31
Anyone know what the usergroup id for (COPPA) Users Awaiting Moderation is??
And i would assume all i'd have to do would be to add that into the code you have JohnM
<?php
include("./global.php");
if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==3 || $bbuserinfo[usergroupid]==?) {
show_nopermission();
}
eval("dooutput(\"".gettemplate("chat")."\");");
?>
Of course i'd replace the ? with whatever the coppa usergroup id is.
Thanks in advance :)
I think I am going to sign up for Digichat hosted chat. Can someone clarify if this code works? And in addition, if you were to be so kind, summarize once again how one would set this up? I'm a dummy in this area, but my members are chatting on my vB and my host is not going to be happy. I must have a chat, and I really need it integrated. Digichat looks sweet, if I can get it to allow only certain groups....
pretty please?
vBulletin® v3.6.12, Copyright ©2000-2012, Jelsoft Enterprises Ltd.