PDA

View Full Version : custom on/off for a forum ID


CRego3D
07-30-2002, 02:13 AM
Little help here :)

this is the code in index.php for the on/off buttons


if ($bbuserinfo['lastvisitdate']=='Never') {
$forum['onoff']='on';
} else {
if (isset($bbforumview[$forum['forumid']]) and $bbforumview[$forum['forumid']]>$bbuserinfo['
lastvisit']) {
$userlastvisit=$bbforumview[$forum['forumid']];
} else {
$userlastvisit=$bbuserinfo['lastvisit'];
}
if ($userlastvisit<$forum['lastpost']) {
$forum['onoff']='on';
} else {
$forum['onoff']='off';
}
}

if ((!$forumperms['canpostnew'] and $showlocks) or $forum['allowposting']==0) {
$forum['onoff'].='lock';
}


now my question is this .. is there a way I can add an IF that says

if forumid equals number 20 (using 20 as an example) then $forum['onoff']='20on'; ... $forum['onoff']='20off';

The idea is to have custom on/off buttons to certain forums .. is this possible ? :)

Carlos

Logician
07-30-2002, 08:26 AM
add


if ($forum['forumid']==X) {$forum['onoff']='20on';}


After:
$forum['onoff']='off';

and

$forum['onoff']='on';
(There are 2 occurences, add it after BOTH of them)

Replace X with the forumid.

Enjoy..

Demonslayer
08-22-2002, 07:50 PM
I've been trying to get this to work to no avial. :( Can you please post the part of the code already modified (i.e. replace this with this)

Thanks in advance :)

Logician
08-22-2002, 08:16 PM
Edit index.php, find:


} else {
$forum['onoff']='off';
}
}


After that add:

if ($forum['forumid']==X AND $forum['onoff']='off') {$forum['onoff']='20off';}
if ($forum['forumid']==X AND $forum['onoff']='on') {$forum['onoff']='20on';}


Dont forget to upload your image files named 20off.gif and 20on.gif to the directory where on.gif and off.gif resides..

Demonslayer
08-22-2002, 10:28 PM
thanks for your quick reply, but i still get the same error....


Parse error: parse error in /home/virtual/site16/fst/var/www/html/forums/index.php on line 301


(line 301 is the first of the 2 lines you said)

Xenon
08-22-2002, 11:12 PM
try to use that:
if ($forum['forumid']==X AND $forum['onoff']=='off') {$forum['onoff']='20off';}
if ($forum['forumid']==X AND $forum['onoff']=='on') {$forum['onoff']='20on';}

pal forgot one = ;)

if the error occurs again, look at one line before...

Demonslayer
08-23-2002, 12:42 PM
same error....:(

Logician
08-23-2002, 02:06 PM
there is no error (at least no parse errors) in this code (after Xenon's correction). Try to reapply carefully..

BTW Are you using Opera as your browser? Then dont copy/paste from here, just type the code manually.

Demonslayer
08-23-2002, 08:32 PM
ok, I'm not home atm, and yes, I was using Opera. When I get home I'll copy & paste with IE. Thanks Logician. :D

Demonslayer
08-23-2002, 10:38 PM
it works now, thanks Logician & Xenon :D