Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Mods & Themes (http://www.bvlist.com/forumdisplay.php?f=97)
-   -   Commenting Rights Enable/Disable (http://www.bvlist.com/showthread.php?t=5026)

\n");
in languages/english/lang_userdetails.php file:

Code:

$userdetails_lang['commpost'] = "Commenting Rights";
$userdetails_lang['commpost'] = "You are not allowed to post comments!";

in modtask.php file:

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);
    }

In details.php

find:
(note ive changed my print to echo same code just with echo instead)

Code:

if (!$count) {
add after:
Code:

  if ($CURUSER["commpost"] != "no")
  {

find:

Code:

    textbbcode("comment","text","");
    echo "
";
    echo "
";
    echo "";
    echo "";
    echo "
blargh 2nd June 2010 01:29

Commenting Rights Enable/Disable
 
sql:

Code:

ALTER TABLE `users` ADD `commpost` ENUM( 'yes', 'no' ) DEFAULT 'yes' NOT NULL;
in userdetails.php file:
find where the mod tools start and place this bit where you want the option to appear

Code:

print("
".$userdetails_lang['commpost']."".$tracker_lang['yes']." ".$tracker_lang['no']."
";
        }

add after:
Code:

  else {
    echo "";
    echo "
";
    echo "
:: ".$tracker_lang['comments']."
";
    echo "
";
    echo "".$tracker_lang['no_comments']."";
    echo "
";
    echo "";
    echo "";
    echo "
 
";
    echo "
";
    }
    }

now right below that will be:

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();

BETWEEN:

Code:

else {
and
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();

ADD:
Code:

  if ($CURUSER["commpost"] != "no")
  {

find:
Code:

        echo "";
        echo "";
        echo "";
        echo "";
        echo "";
        }

add BELOW:
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 "";
        echo "";
        echo "";
        echo "";
        echo "";
        echo "
";
        echo "
:: ".$tracker_lang['comments']."
";
        echo "
";
        echo $pagertop;
        echo "
";
        commenttable($allrows);
        echo "
";
        echo $pagerbottom;
        echo "
";
        echo "";
        echo "";
        echo "
   
";
        }
        }

In comment.php

find:
Code:

if ($action == "add")
{

add BELOW:
Code:

if ($CURUSER["commpost"] != "no")
    {

find:
Code:

      print("

Recent comments, in the reverse order of /h2>\n");
      commenttable($allrows);
    }
  stdfoot();
    die;
}

add BELOW:
Code:

else {
newerr($tracker_lang['error'], 'Your Commenting Rights Have Been Lifted. Please Contact Staff For A Reason');
}
}

find:
Code:

elseif ($action == "quote")
{

add BELOW:
Code:

if ($CURUSER["commpost"] != "no")
    {

find:
Code:

    print("

\n");

    stdfoot();

}

add BELOW:
Code:

else {
newerr($tracker_lang['error'], 'Your Commenting Rights Have Been Lifted. Please Contact Staff For A Reason');
}
}

find:
elseif ($action == "edit")
{
[/code]

add BELOW:
Code:

if ($CURUSER["commpost"] != "no")
    {

find:
Code:

    print("

\n");

    stdfoot();
    die;
}

add BELOW:
Code:

else {
newerr($tracker_lang['error'], 'Your Commenting Rights Have Been Lifted. Please Contact Staff For A Reason');
}
}

and thats it. now you can disable users ability to post comments altogether. if you have users that constantly break your comment rules then just disable their ability to post them.

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

All times are GMT +2. The time now is 12:45.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.