View Full Version : Set Style based on usergroup
amykhar
11-30-2001, 10:00 PM
This hack allows you to set the style for a given user group.
You can choose to ovveride forum styles, or not. I have written another hack that allows premium users to have a set of reserved styles. It can be found here:
https://vborg.vbsupport.ru/showthread.php?s=&threadid=48953
This seems to work for 2.2.1 and higher.
Amy
amykhar
12-01-2001, 04:56 PM
Here is the file. I accidentally deleted it from the original post.
Amy
TheComputerGuy
12-01-2001, 05:09 PM
Nice work Amy...installed
amykhar
12-01-2001, 05:11 PM
Make sure you got this file, and not the one that was in beta last night. It had a bug that I finally squashed for good today.
Amy :)
Excellent hack! Thank you very much. This is just what I needed to free my "Elite" members from seeing a particular banner on all the pages.
Happy Holidays!
Rick Horwitz :D
Princeton
12-22-2001, 03:16 AM
another great hack ... thank you :D
fordinglife
01-13-2002, 12:26 PM
Nevermind, problem fixed.
Has anyone tried this with 2.2.2 yet?
This looks perhaps a promising start to what I'm looking for... namely a way to create styles that can only be selected by certain usergroups.
Is this possible and if so, anyone here know how?
Cheers,
~Regs.
kontrabass
08-24-2002, 03:17 PM
I second Regs' request - I'd love to allow my "supporting members" usergroup the exclusive abiltiy to choose certain styles....
theologyonline
09-11-2002, 07:21 PM
Will this work with 2.2.6?
I am having trouble finding the exact code to replace.
Dean C
09-12-2002, 05:43 PM
this is awesome... im interested as to know if it will work??
- Mist
Okiewan
11-02-2002, 06:06 PM
[QUOTE]Originally posted by kontrabass
I second Regs' request - I'd love to allow my "supporting members" usergroup the exclusive abiltiy to choose certain styles....
amykhar
02-15-2003, 06:55 PM
It still works with the upper versions.
It works perfectly with vB2.2.8. :) Thanks, Amy!
* Rose clicks install
amykhar
03-20-2003, 05:10 PM
Glad you like it :) I don't use it anymore because I use the premium styles one instead.
Amy
I'm using this mainly so that I can set the admin style set when I'm testing styles and such. :D
94supratt
03-22-2003, 06:28 AM
I did not understand this part :(
1. in Phpmyadmin
ALTER TABLE `usergroup` ADD `styleid` TINYINT DEFAULT '1' NOT NULL;
ALTER TABLE `usergroup` ADD `styleoverride` TINYINT DEFAULT '0' NOT NULL;
I am in phpmyadmin and I am in that table. But can someone please explain a little more clear what I'm supposed to do. Excuse me ignorance :D I have hacked my board quite alot but don't understand this part of the hack. Does that mean just run that query on my database?
amykhar
03-22-2003, 01:06 PM
[QUOTE] Does that mean just run that query on my database?
chrisz
03-25-2003, 06:23 AM
Great hack, I am currently stuck.
I am not too sure on how to do this and dont want to stuff anything up so please explain this part a bit more:
1. in Phpmyadmin
ALTER TABLE `usergroup` ADD `styleid` TINYINT DEFAULT '1' NOT NULL;
ALTER TABLE `usergroup` ADD `styleoverride` TINYINT DEFAULT '0' NOT NULL;
chrisz
03-25-2003, 07:09 AM
I am new to phpmyadmin so you will have to explain step by step sorry
amykhar
03-25-2003, 01:17 PM
Chris, rather than reinvent the wheel, I am going to point you to this thread: https://vborg.vbsupport.ru/showthread.php?s=&threadid=39142 for help on running queries, etc.
Amy
chrisz
03-25-2003, 02:52 PM
I know how to run queries.
I just dont know how to run that into that table
chrisz
03-25-2003, 03:02 PM
do I just run it normally?
thats all I have to do?
amykhar
03-25-2003, 04:41 PM
Yep. That's all you have to do :)
Amy
chrisz
03-25-2003, 08:31 PM
lol ok you made it sound hard ^^;
amykhar
03-25-2003, 09:04 PM
It's a pretty old hack. Back then, I think I thought it WAS hard :D
chrisz
03-26-2003, 05:51 AM
lol yeah
sonic3d
05-01-2003, 06:10 PM
works flawlessly.
l8er
sonic
Gizmo99
06-17-2003, 07:03 AM
Just Whot we needed :rambo:
First Class
Giz
allfather
07-14-2003, 01:31 AM
Cant find the lines of codes in global.php
<?php
error_reporting(7);
if (isset($HTTP_GET_VARS['explain']) OR isset($HTTP_POST_VARS['explain'])) {
$showqueries = 1;
$explain = 1;
}
if (isset($HTTP_GET_VARS['showqueries']) OR isset($HTTP_POST_VARS['showqueries']) or isset($showqueries)) {
$showqueries = 1;
$pagestarttime = microtime();
} else {
$pagestarttime = 0;
}
$incp=1;
// allow script to work with registerglobals off
if ( function_exists('ini_get') ) {
$onoff = ini_get('register_globals');
} else {
$onoff = get_cfg_var('register_globals');
}
if ($onoff != 1) {
@extract($HTTP_SERVER_VARS, EXTR_SKIP);
@extract($HTTP_COOKIE_VARS, EXTR_SKIP);
@extract($HTTP_POST_FILES, EXTR_SKIP);
@extract($HTTP_POST_VARS, EXTR_SKIP);
@extract($HTTP_GET_VARS, EXTR_SKIP);
@extract($HTTP_ENV_VARS, EXTR_SKIP);
}
// get rid of slashes in get / post / cookie data
function stripslashesarray (&$arr) {
while (list($key,$val)=each($arr)) {
if ((strtoupper($key)!=$key or "".intval($key)=="$key") and $key!="templatesused" and $key!="argc" and $key!="argv") {
if (is_string($val)) {
$arr[$key]=stripslashes($val);
}
if (is_array($val)) {
$arr[$key]=stripslashesarray($val);
}
}
}
return $arr;
}
if (get_magic_quotes_gpc() and is_array($GLOBALS)) {
// variables created from attachments aren't escaped properly it seems...
if (isset($attachment)) $GLOBALS['attachment'] = addslashes($GLOBALS['attachment']);
if (isset($avatarfile)) $GLOBALS['avatarfile'] = addslashes($GLOBALS['avatarfile']);
if (isset($iconfile)) $GLOBALS['iconfile'] = addslashes($GLOBALS['iconfile']);
if (isset($smiliefile)) $GLOBALS['smiliefile'] = addslashes($GLOBALS['smiliefile']);
if (isset($stylefile)) $GLOBALS['stylefile'] = addslashes($GLOBALS['stylefile']);
$GLOBALS = stripslashesarray($GLOBALS);
}
set_magic_quotes_runtime(0);
// version numbers:
$codeversionnumber="2.3.0";
$codeinfo="";
// initialise variables
unset($forumcache);
unset($threadcache);
unset($postcache);
unset($urlSearchArray);
unset($urlReplaceArray);
unset($emailSearchArray);
unset($emailReplaceArray);
unset($iforumcache);
unset($ipermcache);
unset($iaccesscache);
unset($usergroupdef);
unset($noperms);
unset($usergroupcache);
unset($vars);
unset($usercache);
unset($forumarraycache);
unset($permscache);
unset($foruminfo);
if ($HTTP_GET_VARS['HTTP_POST_VARS']['action'] == $HTTP_POST_VARS['action']) {
unset($HTTP_POST_VARS['action']);
}
$HTTP_POST_VARS['action'] = trim($HTTP_POST_VARS['action']);
if ($HTTP_GET_VARS['HTTP_COOKIE_VARS']['bbadminon'] == $HTTP_COOKIE_VARS['bbadminon']) {
unset($HTTP_POST_VARS['action']);
}
// ###################### Start init #######################
unset($dbservertype);
unset($debug);
//load config
require("./config.php");
if ($debug != 1) {
unset($showqueries);
unset($explain);
}
// init db **********************
// load db class
$dbservertype = strtolower($dbservertype);
$dbclassname="./db_$dbservertype.php";
require($dbclassname);
$DB_site=new DB_Sql_vb;
$DB_site->appname="vBulletin Control Panel";
$DB_site->appshortname="vBulletin (cp)";
$DB_site->database=$dbname;
$DB_site->server=$servername;
$DB_site->user=$dbusername;
$DB_site->password=$dbpassword;
$DB_site->connect();
$dbpassword="";
$DB_site->password="";
// end init db
// load options
$optionstemp=$DB_site->query_first("SELECT template FROM template WHERE title='options'");
eval($optionstemp[template]);
$versionnumber=$templateversion;
// ###################### Start headers #######################
/*
$noheader=1;
if ($addheaders and !$noheader) {
// default headers
header("HTTP/1.0 200 OK");
header("HTTP/1.1 200 OK");
header("Content-type: text/html");
}
*/
if ($nocacheheaders and !$noheader) {
// no caching
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT"); // always modified
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0
}
// ###################### Start functions #######################
require("./functions.php");
require("./adminfunctions.php");
// ###################### Start sessions #######################
/*if (!isset($bbadminon) and !$bbadminon) {
$sessionhash="";
$bbuserinfo[userid]="";
$bbuserinfo[password]="";
}*/
require("./sessions.php");
/*
if (isset($loginusername)) {
if ($user=$DB_site->query_first("SELECT userid,password FROM user WHERE username='".addslashes($loginusername)."'")) {
if ($user[password]==$password) {
$userid=$user[userid];
$bbuserinfo=getuserinfo($userid);
$DB_site->query("UPDATE session SET userid='$userid' WHERE sessionhash='$session[dbsessionhash]'");
}
}
}
*/
if ( isset( $redirect ) ) {
$redirect = htmlspecialchars(str_replace('javascript', 'java script', $redirect));
}
$getperms=$DB_site->query_first("SELECT cancontrolpanel FROM user,usergroup WHERE user.usergroupid=usergroup.usergroupid AND user.userid='$bbuserinfo[userid]'");
if ($getperms[cancontrolpanel]!=1) {
$bbuserinfo[userid]=0;
}
if ($bbuserinfo[userid]!=0 and $loginusername and !$createanonsession) {
vbsetcookie('bbadminon', 1, 0);
$HTTP_COOKIE_VARS['bbadminon']=1;
} else {
if ($bbuserinfo[userid]==0) {
$HTTP_COOKIE_VARS['bbadminon']=0;
}
}
if ($debug!=1) {
// check for files existance. Potential security risks!
if (file_exists("install.php")==1) {
echo "<html><body><p>Security alert! install.php still remains in the admin directory. This poses a security risk, so please delete that file immediately. You cannot access the control panel until you do.</p></body></html>";
exit;
}
if (file_exists("upgrade1.php")==1 and substr($PHP_SELF,-strlen("upgrade1.php"))!="upgrade1.php") {
echo "<html><body><p><a href=\"upgrade1.php?s=$session[sessionhash]\">upgrade1.php</a> exists. If you have already upgraded fully, please delete it. Otherwise, run it now.</p></body></html>";
exit;
}
}
$checkpwd=1;
if ($HTTP_COOKIE_VARS['bbadminon']==0 and substr($PHP_SELF,-strlen("upgrade1.php"))!="upgrade1.php" and $checkpwd) {
$bbuserinfo[userid]=0;
} else {
if ($bbuserinfo['userid']!=0 and $loginusername and !$createanonsession) {
setcookie("bbadminon",1,0,'/');
$HTTP_COOKIE_VARS['bbadminon']=1;
}
}
if ($bbuserinfo[userid]==0 and $checkpwd) {
cpheader("<title>Forums admin</title>");
?><br><br><br>
<table cellpadding="1" cellspacing="0" border="0" class="tblborder" align="center" width="450"><tr><td>
<table cellpadding="4" cellspacing="0" border="0" width="100%">
<?php maketableheader("Please Log in:","login",0,1); ?>
<tr class="firstalt" id="submitrow"><td align="center" nowrap><p>You are either not a valid administrator or have not logged in.</p>
<form action="../admin/index.php" method="post" id="submitrow">
<input type="hidden" name="s" value="<?php echo $session[sessionhash]; ?>">
<input type="hidden" name="action" value="login">
<!-- <input type="hidden" name="explain" value="1"> -->
<input type="hidden" name="redirect" value="<?php
if ($HTTP_SERVER_VARS['REQUEST_URI']!="") {
$url = $HTTP_SERVER_VARS['REQUEST_URI'];
} else {
if ($PATH_INFO) {
$url = $PATH_INFO;
} else {
$url = $PHP_SELF;
}
if ($QUERY_STRING) {
$url .= "?$QUERY_STRING";
}
}
$url=ereg_replace("sessionhash=[a-z0-9]{32}&","",$url);
$url=ereg_replace("\\?sessionhash=[a-z0-9]{32}","",$url);
$url=ereg_replace("s=[a-z0-9]{32}&","",$url);
$url=ereg_replace("\\?s=[a-z0-9]{32}","",$url);
echo htmlspecialchars(str_replace('javascript', 'java script', $url));
?>">
<table cellpadding="0" cellspacing="1" border="0">
<tr>
<td><input type="text" name="loginusername"></td>
<td><input type="password" name="loginpassword"></td>
<td><input type="submit" value=" Log in " accesskey="s"></td>
</tr>
<tr>
<td><font size="1">Username</font></td>
<td colspan="2"><font size="1">Password</font></td>
</tr>
</table>
</form>
</td></tr></table>
</td></tr></table>
<p align="center"><font size="1">vBulletin v<?php echo $templateversion ?> Administrator Control Panel</font></p>
<?php
cpfooter();
exit;
}
?>
is my global.php :s
(will delete if someone tells me what to do,or if someone says "WTF, WIERDEST GLOBAL.PHP EVER !!!" :banana:
\ \ - Speedy - / /
09-06-2003, 11:34 PM
can someone update this for 2.3.2 (i can't get global.php to work ether.
- Speedy
pgowder
03-05-2004, 05:19 PM
I'm getting errors from this emailed to me at certain times during the day. On some days they come in hundreds at a time. Here's the erro
Database error in vBulletin 2.2.8:
Invalid SQL: Select styleid, styleoverride from usergroup where usergroupid=
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
mysql error number: 1064
Date: Tuesday 24th of February 2004 03:07:45 PM
Script: http://www.powwows.com/gathering/ga...hp?postid=88010
Referer: http://www.powwows.com/gathering/sh...20&pagenumber=2
Anyone seen this?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.