Best of joomla gives you news, joomla templates, tutorials and websites about Joomla , FireBoard and FireMessage official page.
| No account yet?   |
Welcome, Guest
Please Login or Register.    Lost Password?
Allow a user to delete their own post (1 viewing) (1) Guest
Go to bottom Favoured: 5
TOPIC: Allow a user to delete their own post
#30948
Allow a user to delete their own post 10 Months ago  
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)
masterchief (User)
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
Logged Logged
 
Andrew Eddie
Joomla! Development Coordinator
www.jxtended.com
 
The administrator has disabled public write access.  
#30979
Re:Allow a user to delete their own post 9 Months, 4 Weeks ago  
Is it possible for you to put a time limit on this?
TDN (User)
Junior Boarder
Posts: 25
graphgraph
User Offline Click here to see the profile of this user
Logged Logged
 
The administrator has disabled public write access.  
#31918
Re:Allow a user to delete their own post 9 Months, 2 Weeks 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) )
jabberwock (User)
We're flying today.
Senior Boarder
Posts: 43
graphgraph
User Offline Click here to see the profile of this user
Dynamic Code Works michaelmiller1 @nospamrm @hotmail.com Location: Canada
Logged Logged
 
We are what we repeatedly do. Excellence, then, is not an act, but a habit - Aristotle
 
The administrator has disabled public write access.  
#31922
Re:Allow a user to delete their own post 9 Months, 2 Weeks 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.
grumblemarc (User)
Platinum Boarder
Posts: 3557
graph
User Offline Click here to see the profile of this user
Gender: Male
Logged Logged
 
The administrator has disabled public write access.  
#31925
Re:Allow a user to delete their own post 9 Months, 2 Weeks 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.
jabberwock (User)
We're flying today.
Senior Boarder
Posts: 43
graphgraph
User Offline Click here to see the profile of this user
Dynamic Code Works michaelmiller1 @nospamrm @hotmail.com Location: Canada
Logged Logged
 
We are what we repeatedly do. Excellence, then, is not an act, but a habit - Aristotle
 
The administrator has disabled public write access.  
#32116
Re:Allow a user to delete their own post 9 Months, 2 Weeks 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
manhag (User)
Senior Boarder
Posts: 71
graphgraph
User Offline Click here to see the profile of this user
Logged Logged
 
idont hate a fireboard moderator

karma [size=4][color=#c0c9c0][u][url=www.bestofjoomla.com/component/option,co...rease/userid,897/pid
 
The administrator has disabled public write access.  
#32119
Re:Allow a user to delete their own post 9 Months, 2 Weeks ago  
Sounds like you're running PHP5. Please check that all of the FB requirements are being met.
grumblemarc (User)
Platinum Boarder
Posts: 3557
graph
User Offline Click here to see the profile of this user
Gender: Male
Logged Logged
 
The administrator has disabled public write access.  
#33254
Re:Allow a user to delete their own post 9 Months, 1 Week 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 (User)
Junior Boarder
Posts: 25
graphgraph
User Offline Click here to see the profile of this user
Logged Logged
 
The administrator has disabled public write access.  
#43576
Re:Allow a user to delete their own post 7 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.
iosoft (User)
Platinum Boarder
Posts: 419
graphgraph
User Online Now Click here to see the profile of this user
Gender: Male futureiosoft Location: Kolkata, INDIA Birthdate: 1981-08-06
Logged Logged
 
Developer: FB-Poll System, FB-Joomap plugin, FB-OpenSEF extension, FB-Primezilla Hacker, Fireboard WAP.
Vote my site- GigaHertZ
 
The administrator has disabled public write access.  
#51428
Re:Allow a user to delete their own post 3 Months, 1 Week 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
daforuiner (User)
Fresh Boarder
Posts: 18
graphgraph
User Offline Click here to see the profile of this user
Logged Logged
 
The administrator has disabled public write access.  
Go to top
Powered by FireBoard - Creditsget the latest posts directly to your desktop