|
#1
|
|||
|
|||
Commenting Rights Enable/Disable
sql:
Code:
ALTER TABLE `users` ADD `commpost` ENUM( 'yes', 'no' ) DEFAULT 'yes' NOT NULL; find where the mod tools start and place this bit where you want the option to appear Code:
print("<tr><td class=\"rowhead\">".$userdetails_lang['commpost']."</td><td colspan=\"2\" align=\"left\"><input type=\"radio\" name=\"commpost\" value=\"yes\"" .($user["commpost"] == "yes" ? " checked=\"checked\"" : "")." />".$tracker_lang['yes']." <input type=\"radio\" name=\"commpost\" value=\"no\"" .($user["commpost"] == "no" ? " checked=\"checked\"" : "")." />".$tracker_lang['no']."</td></tr>\n"); Code:
$userdetails_lang['commpost'] = "Commenting Rights"; $userdetails_lang['commpost'] = "You are not allowed to post comments!"; Code:
// Comment Post Enable / Disable if ((isset($_POST['commpost'])) && (($commpost = $_POST['commpost']) != $user['commpost'])) { if ($commpost == 'yes') { $modcomment = get_date( time(), 'DATE', 1 ) . " - Comment posting enabled by " . $CURUSER['username'] . ".\n" . $modcomment; $msg = sqlesc("Your Comment posting rights have been given back by ".$CURUSER['username'].". You can post comments again."); $added = time(); mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__); } else { $modcomment = get_date( time(), 'DATE', 1 ) . " - Comment posting disabled by " . $CURUSER['username'] . ".\n" . $modcomment; $msg = sqlesc("Your Comment posting rights have been removed by ".$CURUSER['username'].", Please PM ".$CURUSER['username']." for the reason why."); $added = time(); mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__); } $updateset[] = "commpost = " . sqlesc($commpost); } find: (note ive changed my print to echo same code just with echo instead) Code:
if (!$count) { Code:
if ($CURUSER["commpost"] != "no") { Code:
textbbcode("comment","text",""); echo "</div>"; echo "</td></tr><tr><td align=\"center\" colspan=\"2\">"; echo "<input type=\"hidden\" name=\"tid\" value=\"$id\"/>"; echo "<input type=\"submit\" class=btn value=\"".$tracker_lang['add_comment']."\" />"; echo "</td></tr></form></table>"; } Code:
else { echo "<table style=\"margin-top: 2px;\" cellpadding=\"5\" width=\"100%\">"; echo "<tr><td class=colhead align=\"left\" colspan=\"2\">"; echo "<div style=\"float: left; width: auto;\" align=\"left\"> :: ".$tracker_lang['comments']."</div>"; echo "</td></tr><tr><td align=\"center\">"; echo "".$tracker_lang['no_comments'].""; echo "</td></tr></table><br>"; echo "<table style=\"margin-top: 2px;\" cellpadding=\"5\" width=\"100%\">"; echo "<tr><td class=colhead align=\"left\" colspan=\"2\"> <a name=comments> </a></td></tr>"; echo "<tr><td align=\"center\" >"; echo "</table>"; } } Code:
else { list($pagertop, $pagerbottom, $limit) = pager($limited, $count, "details.php?id=$id&", array(lastpagedefault => 1)); $subres = sql_query("SELECT c.id, c.ip, c.text, c.user, c.added, c.editedby, c.editedat, u.avatar, u.warned, ". "u.username, u.title, u.class, u.donor, u.downloaded, u.uploaded, u.gender, u.last_access, e.username AS editedbyname FROM ".TABLE_COMMENTS." AS c LEFT JOIN ".TABLE_USERS." AS u ON c.user = u.id LEFT JOIN ".TABLE_USERS." AS e ON c.editedby = e.id WHERE torrent = " . "$id ORDER BY c.id $limit") or sqlerr(__FILE__, __LINE__); $allrows = array(); Code:
else { Code:
list($pagertop, $pagerbottom, $limit) = pager($limited, $count, "details.php?id=$id&", array(lastpagedefault => 1)); $subres = sql_query("SELECT c.id, c.ip, c.text, c.user, c.added, c.editedby, c.editedat, u.avatar, u.warned, ". "u.username, u.title, u.class, u.donor, u.downloaded, u.uploaded, u.gender, u.last_access, e.username AS editedbyname FROM ".TABLE_COMMENTS." AS c LEFT JOIN ".TABLE_USERS." AS u ON c.user = u.id LEFT JOIN ".TABLE_USERS." AS e ON c.editedby = e.id WHERE torrent = " . "$id ORDER BY c.id $limit") or sqlerr(__FILE__, __LINE__); $allrows = array(); Code:
if ($CURUSER["commpost"] != "no") { Code:
echo "</td></tr></table></center>"; echo "</td></tr><tr><td align=\"center\" colspan=\"2\">"; echo "<input type=\"hidden\" name=\"tid\" value=\"$id\"/>"; echo "<input type=\"submit\" class=btn value=\"".$tracker_lang['add_comment']."\" />"; echo "</td></tr></form></table>"; } Code:
else { list($pagertop, $pagerbottom, $limit) = pager($limited, $count, "details.php?id=$id&", array(lastpagedefault => 1)); $subres = sql_query("SELECT c.id, c.ip, c.text, c.user, c.added, c.editedby, c.editedat, u.avatar, u.warned, ". "u.username, u.title, u.class, u.donor, u.downloaded, u.uploaded, u.gender, u.last_access, e.username AS editedbyname FROM ".TABLE_COMMENTS." AS c LEFT JOIN ".TABLE_USERS." AS u ON c.user = u.id LEFT JOIN ".TABLE_USERS." AS e ON c.editedby = e.id WHERE torrent = " . "$id ORDER BY c.id $limit") or sqlerr(__FILE__, __LINE__); $allrows = array(); while ($subrow = mysql_fetch_array($subres)) $allrows[] = $subrow; echo "<table class=main cellspacing=\"0\" cellPadding=\"5\" width=\"100%\" >"; echo "<tr><td class=\"colhead\" align=\"center\" >"; echo "<div style=\"float: left; width: auto;\" align=\"left\"> :: ".$tracker_lang['comments']."</div>"; echo "</td></tr>"; echo "<tr><td>"; echo $pagertop; echo "</td></tr>"; echo "<tr><td>"; commenttable($allrows); echo "</td></tr>"; echo "<tr><td>"; echo $pagerbottom; echo "</td></tr>"; echo "</table>"; echo "<table style=\"margin-top: 2px;\" cellpadding=\"5\" width=\"100%\">"; echo "<tr><td class=colhead align=\"left\" colspan=\"2\"> <a name=comments> </a></td></tr>"; echo "</table>"; } } find: Code:
if ($action == "add") { Code:
if ($CURUSER["commpost"] != "no") { Code:
print("<h2>Recent comments, in the reverse order of /h2>\n"); commenttable($allrows); } stdfoot(); die; } Code:
else { newerr($tracker_lang['error'], 'Your Commenting Rights Have Been Lifted. Please Contact Staff For A Reason'); } } Code:
elseif ($action == "quote") { Code:
if ($CURUSER["commpost"] != "no") { Code:
print("<p><input type=\"submit\" value=\"Submit\" /></p></form>\n"); stdfoot(); } Code:
else { newerr($tracker_lang['error'], 'Your Commenting Rights Have Been Lifted. Please Contact Staff For A Reason'); } } elseif ($action == "edit") { [/code] add BELOW: Code:
if ($CURUSER["commpost"] != "no") { Code:
print("<p><input type=\"submit\" value=\"Edit!\" /></p></form>\n"); stdfoot(); die; } Code:
else { newerr($tracker_lang['error'], 'Your Commenting Rights Have Been Lifted. Please Contact Staff For A Reason'); } } This mod was adapted from the TBDev 09 mod to disable/enable forum/download/upload rights found here: http://www.tbdev.net/index.php?showtopic=21638 and working on Yuna Scatari pre7 by BoLaMN *EDITED* ive updated the post to clean up the code a bit. and ive added a check for editing and replying to comments aswell. hope you enjoy Last edited by blargh; 5th June 2010 at 01:06. |
The Following User Says Thank You to blargh For This Useful Post: | ||
look (26th March 2012)
|
Tags |
commenting , enable or disable , rights |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
news commenting | leicha | Yuna Scatari Edition (YSE) | 0 | 13th June 2010 11:52 |
How to enable ADS in FTS 1.1 | yoligim | Free Torrent Source | 2 | 31st January 2010 22:27 |
[FTS 1.0] Enable disable Leftmenu for UserCP | elvira | Mods & Themes | 0 | 9th January 2010 00:07 |
Remove karma system rights for one user | elvira | Mods & Themes | 1 | 8th December 2009 11:21 |
Enable/Disable mods [ need help] | D3SI | TBDev | 0 | 10th October 2008 19:03 |