Usual disclaimers: don't blame me if it breaks, back it up, and so on
Step 1: Allow the delete button to be seen by the author.
File: /components/com_firboard/template/default/view.php
Look for the link with
func=post&do=delete in it. Change the code around
if ($is_moderator) as follows:
| Code: |
// TCC HACKS FOR AUTHOR TO DELETE THEIR POST
if ($fbConfig['useredit'] && $my_id != '' && $my_id == $fmessage->userid) {
$showedDelete = 1;
} else if ($is_moderator) {
$showedDelete = 1;
} else {
$showedDelete = 0;
}
//Offer an moderator the delete link
//if ($is_moderator)
if ($showedDelete)
// END TCC HACK
|
Step 2: Allow the user to delete the post
File: /components/com_firboard/template/default/post.php
Look for the
do == 'delete' code, change as follows:
| Code: |
else if ($do == "delete"«»)
{
// TCC HACKS FOR AUTHOR TO DELETE THEIR POST
$id = (int)$id;
$database->setQuery("SELECT * FROM #__fb_messages WHERE id=$id"«»);
$message = $database->loadObjectList();
foreach ($message as $mes)
{
if ($fbConfig['useredit'] && $my_id != '' && $my_id == $mes->userid) {
// OK, do nothing
} else if (!$is_moderator) {
die("Hacking Attempt!"«»);
}
// END TCC HACK
?>
|
And then look for the
do == 'deletepostnow' code and change as follows:
| Code: |
else if ($do == "deletepostnow"«»)
{
// TCC HACKS FOR AUTHOR TO DELETE THEIR POST
$id = (int)mosGetParam($_POST, 'id', '');
$dellattach = mosGetParam($_POST, 'delAttachments', '') == 'delAtt' ? 1 : 0;
$database->setQuery("SELECT * FROM #__fb_messages WHERE id=$id"«»);
if ($message = $database->loadObjectList())
{
if ($fbConfig['useredit'] && $my_id != '' && $my_id == $message[0]->userid) {
// OK, continue
} else if (!$is_moderator) {
die("Hacking Attempt!"«»);
}
}
// END TCC HACK
$thread = fb_delete_post($database, $id, $dellattach);
|
Hacks sponsored by Toowoomba City Council (Australia)