Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Yuna Scatari Edition (YSE) (http://www.bvlist.com/forumdisplay.php?f=22)
-   -   Forums.. (http://www.bvlist.com/showthread.php?t=3014)

Nilsons 16th July 2009 12:51

Forums..
 
So i added to my forums locked reason and unlock reason... when i lock topic it posts new post - And there writes reason and who locked topic....

But i want to ask you how to do this- When i unlock topic the post that was posted with reason why locked automaticly removed ? what code i need to put?

Heres the code -
Code:

///// Add reason to locked code - TBDev - Dokty /////
if ($action == "setlocked")
  {
    $topicid = 0 + $_POST["topicid"];

    if (!$topicid || get_user_class() < UC_MODERATOR)
      die;

    $res2345 = mysql_query("SELECT locked FROM topics WHERE id = " . $topicid) or sqlerr(__FILE__, __LINE__);
        if (mysql_num_rows($res2345) != 1)
            die("Error - No topic with this ID.");
        $arr2345 = mysql_fetch_assoc($res2345);

    $locked = sqlesc($_POST["locked"]);
    mysql_query("UPDATE topics SET locked=$locked WHERE id=$topicid") or sqlerr(__FILE__, __LINE__);
       

        if (($locked != $arr2345["locked"]) && ($_POST["locked"] == "yes")) {
$body = sqlesc("
Topic Locked by ".$CURUSER['username']."\nReason: ".$_POST["lockreason"].".
");
    mysql_query("INSERT INTO posts (topicid, userid, added, body) VALUES($topicid, ".$CURUSER['id'].", '" . get_date_time() . "', $body)") or sqlerr(__FILE__, __LINE__);
    $postid = mysql_insert_id() or die("Post id n/a");
    update_topic_last_post($topicid);
}
        if (($locked != $arr2345["locked"]) && ($_POST["locked"] == "no")) {
        mysql_query("UPDATE posts"
        $postid = mysql_insert_id() or die("Post id n/a");
    update_topic_last_post($topicid);
        $body = sqlesc("
Topic UnLocked by ".$CURUSER['username']."\nReason: ".$_POST["lockreason"].".
");
        mysql_query("INSERT INTO posts (topicid, userid, added, body) VALUES($topicid, ".$CURUSER['id'].", '" . get_date_time() . "', $body)") or sqlerr(__FILE__, __LINE__);
    $postid = mysql_insert_id() or die("Post id n/a");
    update_topic_last_post($topicid);
        }
$returnto = str_replace ('&', '&', htmlentities($_POST["returnto"]));
    header("Location: ".$returnto);
    die;
  }

I tried to do something but im not a coder im trying to learn something .. But i gues that i was doing wrong :D



Sorry my english is terrible :D

BoLaMN 16th July 2009 15:32

so when u unlock the topic u want the

Topic Locked by ".$CURUSER['username']."\nReason: ".$_POST["lockreason"].".

post to be removed automatically?

Nilsons 16th July 2009 17:14

Yap that is what i want :)

Bump: I thought that in this forum is wery helpful peaople... Great coders why don't you help me

Bump: Thanks for no help :wallbash::sorry::smack:


All times are GMT +2. The time now is 13:39.

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