Dear FireBoard users,
In order to further develope the need of Joomla for a robust forum, FireBoard component has been moved to its own new home and new name. You can find more information regarding the Kunena, the successor of FireBoard, at kunena.com. The current forum here will stay for some time more for referencing needs. You can find the FireBoard files under joomlacode.org and other files
Upgrading to Kunena is highly recommended!

Kunena! - To Speak!

A revolution is coming... Kunena - Swahili for: To Speak! THE Next generation of native Joomla based Forum ultra component. Forget what you know about Joomla based forums...
Amazingly Simple Lean and Clean Easier Customization
Kunena is about to redefine the world of Joomla! with the most simplistic ultra component out there. For ultimate performance based on state of the art development techniques, Kunena! is about to bring you... With an integrated plugin system that will allow you to extend Kunena beyond your wildest imaginations...
TOPIC: Allow a user to delete their own post
#30948
Allow a user to delete their own post 10 Years ago  
Usual disclaimers: don\'t blame me if it breaks, back it up, and so on :)

[b]Step 1: Allow the delete button to be seen by the author.[/b]

File: /components/com_firboard/template/default/view.php

Look for the link with [b]func=post&do=delete[/b] in it. Change the code around [b]if ($is_moderator)[/b] as follows:

[code:1] // 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[/code:1]

[b]Step 2: Allow the user to delete the post[/b]

File: /components/com_firboard/template/default/post.php

Look for the [b]do == \'delete\'[/b] code, change as follows:

[code:1] 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
?>

[/code:1]

And then look for the [b]do == \'deletepostnow\'[/b] code and change as follows:

[code:1] 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);[/code:1]

Hacks sponsored by Toowoomba City Council (Australia)
#30948
Allow a user to delete their own post 10 Years ago  
Usual disclaimers: don\'t blame me if it breaks, back it up, and so on :)

[b]Step 1: Allow the delete button to be seen by the author.[/b]

File: /components/com_firboard/template/default/view.php

Look for the link with [b]func=post&do=delete[/b] in it. Change the code around [b]if ($is_moderator)[/b] as follows:

[code:1] // 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[/code:1]

[b]Step 2: Allow the user to delete the post[/b]

File: /components/com_firboard/template/default/post.php

Look for the [b]do == \'delete\'[/b] code, change as follows:

[code:1] 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
?>

[/code:1]

And then look for the [b]do == \'deletepostnow\'[/b] code and change as follows:

[code:1] 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);[/code:1]

Hacks sponsored by Toowoomba City Council (Australia)
#30979
Re:Allow a user to delete their own post 10 Years ago  
Is it possible for you to put a time limit on this?
TDN
#31918
Re:Allow a user to delete their own post 10 Years ago  
The only problem with this hack is when the person has the parent post of a topic this will allow them to delete the entire topic including children that they didn\'t create.

I\'ll post a fix for this in a bit (along with the code that allows you to put a time limit on this from the usereditTimeGrace configuration value (thanks for the suggestion TDN) )
#31922
Re:Allow a user to delete their own post 10 Years ago  
I don\'t see that as a problem. Some forums allow you to do this. How about a different version of the hack? One that does. One that doesn\'t.
#31925
Re:Allow a user to delete their own post 10 Years ago  
I\'m just thinking about this still. I\'ve got a version which deletes the whole thread if the person deletes the Forum Topic (with it using the time limits), but it seems that in a many cases allowing a person to delete a full thread that has a hundred posts under it seems like a bad thing to do.

(think a person with a grudge decides that they don\'t like the forum and delete all their posts (many of which are Forum Topic posts and so deletes many other users posts in the forums))

I\'m thinking on erring on the delete only one post for the user is the way to go.

Also trying to decide if the time limit should be based on the usereditTime and usereditTimeGrace variables in the configuration file (like I have it in my testing version) or create a new configuration variable userDeleteTime that can be set to a different time.
#32116
Re:Allow a user to delete their own post 9 Years, 12 Months ago  
the hack is not working at alll


Parse error: syntax error, unexpected T_ELSE in /home/********/public_html/joomla/components/com_fireboard/template/default/post.php on line 805
#32119
Re:Allow a user to delete their own post 9 Years, 12 Months ago  
Sounds like you\'re running PHP5. Please check that all of the FB requirements are being met.
#33254
Re:Allow a user to delete their own post 9 Years, 11 Months ago  
Well, if there\'s going to be problems with users deleting an entire topic, then perhaps Fireboard could implement a Trash Can (like how IPB & vBulletin work). Alternatively, prevent users from deleting the first post of a topic, unless it has zero replies.
TDN
#43576
Re:Allow a user to delete their own post 9 Years, 9 Months ago  
Please, improve the code so that Owner of the thread can delete his/her own post and thread within a specified Category specified by Admin from the FB-Backend (like Category property)

It will be a complete MOD.
#51428
Re:Allow a user to delete their own post 9 Years, 5 Months ago  
Is there no way that this can be done on the configuration page?

Will this ONLY allow the user to delete their posts?

Thank you
Page: 12