php forum
php mysql forum
php mysql smarty
 
Topic Options
#209046 - 03/18/01 01:05 PM Admin or Mod only initiate new threads hack
Jockox3 Offline
User

Registered: 01/15/01
Posts: 32
Loc: Oxford, United Kingdom
I was determined to share whatever I learned in playing with PHP and W3T and I've seen a few people asking for a PHP version of something Eileen did in Perl to prevent anyone but mods and admins from starting a new thread. e.g I want to use it to have news boards where only reporters can post original news items but where all users can discuss the news items afterwards:<br /><br />In config.inc.php add a config variable:<br /> $config['modonlyboards'] = "comma,separated,list,of,boards,to,which,this,applies"<br /><br />Then in postlist.php find the following (around line 380 in my copy) and hack into it as follows:<br /><br />// ---------------------------------------------------------------------<br />// We need to check and see if they have write privileges for this forum<br /> $gsize = sizeof($Grouparray);<br /> for ($i=0; $i <$gsize; $i++) {<br /> if (ereg("-$Grouparray[$i]-",$CanWrite) ) {<br /> $makepost = "yes";<br /> break;<br /> }<br /> }<br />// Jock: addition to test if this is a board where only mods can initiate<br />// a new thread.<br /><br /> if (strpos($config[modonlyboards],$Board)) {<br /> $makepost = "no";<br /> }<br /> if ($user[U_Status] == "Administrator") {<br /> $makepost = "yes";<br /> }<br /> if ($user[U_Status] == "Moderator") {<br /><br /> // Check if they moderate this board<br /> $Username_q = addslashes($Username);<br /> $query = "<br /> SELECT Mod_Board<br /> FROM w3t_Moderators<br /> WHERE Mod_Username = '$Username_q'<br /> AND Mod_Board = '$Board_q'<br /> ";<br /> $sth = $dbh -> do_query($query);<br /> $rows = $dbh -> fetch_array($sth);<br /> $dbh -> finish_sth($sth);<br /> if ($rows[0]) {<br /> $makepost = "yes";<br /> }<br /> } <br />// Jock: end addition to test if this is a board where only mods can initiate<br />// a new thread.<br /><br /> if ($makepost == "yes") {<br /> echo "<a href=\"$config[phpurl]/newpost.php?Cat=$Cat&Board=$Board&page=$page&view=$view&sb=$sb\"><img $images[newpost] src=\"$config[images]/newpost.gif\" alt=\"$lang[MAKE_A_NEW]\" border=0></a>";<br /> }<br /> else {<br /> echo "<img alt=\"*\" src=\"$config[images]/greynewpost.gif\" $images[newpost]>";<br /> }<br /><br />I hope I'm doing this right and people can follow all that. And I hope someone finds that useful.<br /><br />To improve it I need to do something in newpost to jump out if for some reason someone manages to get into the post screen on one of these boards, and maybe create something in config to let users select which boards to make mod post only.<br /><br />Jock<br /><br />

Top


Who's Online
0 registered (), 24 Guests and 15 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Spell Check [beta]
by Bill B
Today at 09:16 PM
PhotoPost BB Code Popup
by AllenAyres
Today at 09:41 AM
Problems reading a lot of old posts here
by AllenAyres
Today at 09:35 AM
Forum 'Trader Ratings'.
by AllenAyres
Today at 09:33 AM
Customization needed
by Gizmo
11/12/08 12:28 PM
Team UBBDev Rides Again!
by AllenAyres
11/11/08 02:16 PM
Active Topics.
by AllenAyres
11/11/08 02:13 PM
New Mods
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Spell Check [beta]
by
10/17/06 09:24 PM
Newest Members
David DelMonte, nick1, Begbie, cenk, MATTO
13363 Registered Users
Top Posters
AllenAyres 25452
JoshPet 11330
Rick 8372
LK 7396
Lord Dexter 6503
Greg Hard 5533
Charles Capps 5438

 

 

 
fusionbb message board php hacks