PDA

View Full Version : Individual Forum Colours


ZombieAndy
08-08-2007, 09:48 PM
Ok im a coder of limited experience and ive been trying to crack this one for a long time to no avail, so im bringing it here in the hope that some of the more experienced guys will be able to help me out :)

I want to make a forum a certain colour when viewed from a certain style, but not others.

For example, if i have three styles, Style 1, 2 and 3.

if a user is using style 2 as their style, when they go into general discussion i want them to view it through style 3, but every other forum on my board through style 2. where-as if another member is using style 1 as their style and go into general discussion, i dont want them effected.

you guys see what im trying to do with this and does anyone know how it could be done?

MeNeedHelp
08-08-2007, 10:43 PM
Unless I do not get what you are trying to do, me thinks this would work...

if ($forumid == x AND $vbulletin->userinfo['styleid'] == y)
$vbulletin->userinfo['styleid'] = z;

ZombieAndy
08-08-2007, 10:59 PM
Call me thick if you like but what template/file is this applied to?

MeNeedHelp
08-08-2007, 11:03 PM
You could insert this in the global.php file.
($hook = vBulletinHook::fetch_hook('style_fetch')) ? eval($hook) : false;

Are your users allowed to switch styles on their own?

ZombieAndy
08-08-2007, 11:09 PM
You could insert this in the global.php file.
($hook = vBulletinHook::fetch_hook('style_fetch')) ? eval($hook) : false;

Are your users allowed to switch styles on their own?
Yes.

MeNeedHelp
08-08-2007, 11:13 PM
Then not sure whats the point of forcing a certain style on them if they can simply change it.

You will also need to override the $styleid variable in the same conditional.
I have not tested this but its a good place to start.
Good luck.

ZombieAndy
08-08-2007, 11:24 PM
Then not sure whats the point of forcing a certain style on them if they can simply change it.
The webmaster on our site (my boss) wants a specific style where when viewed, our general discussion is green and not white (standard colour).

Other question, does the second style (the one being forced) have to be an active style? i would rather our users not be able to select it.

MeNeedHelp
08-08-2007, 11:42 PM
The style does not have to be active.

if ($forumid == 2 AND $vbulletin->userinfo['styleid'] == 1)
{
$vbulletin->userinfo['styleid'] = 2;
$styleid = 2;
}

That should work but if you want to apply this to a category you will have to expand the conditional to include the forum's children ids.

ZombieAndy
08-09-2007, 12:05 AM
Thats working great, thanks alot for your help man :)