PDA

View Full Version : Edit/ delete shoutbox posts


rickasawr
05-03-2011, 06:31 PM
yeah, i dont really like going to my MySQL database to edit/ delete shoutbox comments, so maybe make a script to edit/ delete shoutbox posts?

I would love you forever. :meow:

Kaeliah
05-03-2011, 10:54 PM
Alright. In the shoutbox php, just after the start script paste this:

$act = $_GET['act'];
if($act == 'delete'){
// Delete the one shout.
$group = getgroup();
if($group == 1 || $group == 2){
$id = $_GET['id'];
runquery("DELETE FROM ".$prefix."shoutbox WHERE id='$id'");
$result = 'Shout was deleted.<br><br>';
}
}

Then replace the ENTIRE while loop(it's the only one on the page) with this:


while ($i < $num) {
$id=@mysql_result($result,$i,"id");
$user=@mysql_result($result,$i,"user");
$date=@mysql_result($result,$i,"date");
$nolinecomment=@mysql_result($result,$i,"comment");
$nolinecomment = bbconvert($nolinecomment);
$comment=nl2br($nolinecomment);
$group = getgroup();
if($group == 1 || $group == 2){
$mod_shoutbox = '<br><a href="shoutbox.php?act=delete&id='.$id.'">Delete</a>';
}
$commentdiv = "<div class='comment' style='width:94%;padding:2%;background-color:aliceblue;margin-bottom:5px;'><div class='userdate' style='width:50%;height:25px;color:red;'>".$user." - ".$date."</div>".$comment.$mod_shoutbox"</div>";
$article_content = $article_content.$commentdiv;
$i++;
}

while to } (end bracket).

That should do it for ya. Let me know if there's any issues.

Hall of Famer
05-05-2011, 11:19 AM
Well actually, the shoutbox will undergo a completely redesign in Mys v1.3.0... Anyway nice solution to this problem, Kaeliah.

Nemesis
05-05-2011, 11:56 AM
lol i was gonna suggest the sql upon reading the topic :displeased: glad kaeliah could come up with an nice fix. And i can't wait for Mys v1.3.0:wiii: the security issues will be fixed right?

Kaeliah
05-05-2011, 04:17 PM
Yes, that is priority one for 1.3.0. It will also be much more efficient with some random stupid codes being removed.