Disable deleting and editing posts
-
soylentgreen
- Regular
- Posts: 28
- Joined: Sun Aug 20, 2006 2:54 pm
Disable deleting and editing posts
Hi
is there a way to forbid the editing and deleting of an user's own posts? The users should be allowed to create new ones, but it is neccessary that existing ones cannot be changed or removed.
I thought about removing the edit and delete links in the template, but there might be a more elegant solution.
any help would be appreciated
is there a way to forbid the editing and deleting of an user's own posts? The users should be allowed to create new ones, but it is neccessary that existing ones cannot be changed or removed.
I thought about removing the edit and delete links in the template, but there might be a more elegant solution.
any help would be appreciated
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Disable deleting and editing posts
Hi!
You could do that by creating a custom PHP plugin, that checks if an item is being edited, and denies access. You can hook into the corresponding backend_display and other event hooks to check the item.
Serendipity itself does not restrict that, because in a blog environment its highly unusuall that an entry owner should not be able to edit his entries.
Best regards,
Garvin
You could do that by creating a custom PHP plugin, that checks if an item is being edited, and denies access. You can hook into the corresponding backend_display and other event hooks to check the item.
Serendipity itself does not restrict that, because in a blog environment its highly unusuall that an entry owner should not be able to edit his entries.
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
soylentgreen
- Regular
- Posts: 28
- Joined: Sun Aug 20, 2006 2:54 pm
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
There is some documentation on www.s9y.org, and many things can be done by just looking at existing plugins.
The 'serendipity_event_entrycheck' plugin (available via spartacus) already goes into a similar direction, you can look that up for an example
Best regards,
Garvin
There is some documentation on www.s9y.org, and many things can be done by just looking at existing plugins.
The 'serendipity_event_entrycheck' plugin (available via spartacus) already goes into a similar direction, you can look that up for an example
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
soylentgreen
- Regular
- Posts: 28
- Joined: Sun Aug 20, 2006 2:54 pm
Please send me a note when you finish the plugin, I would use it as well, due to the same problem.soylentgreen wrote:thank you, i'll have a look
Filip
http://BrainKing.com - play 80+ popular board games for free, 30,000+ registered users
http://BrainKing.info - the official blog of the BrainKing game site
http://BrainKing.info - the official blog of the BrainKing game site
-
soylentgreen
- Regular
- Posts: 28
- Joined: Sun Aug 20, 2006 2:54 pm
the hook api tells the followingjudebert wrote:I don't think it's possible to cancel a hook once it's started.
I think you'll need to change the event_data instead.
would be setting the entry data's id to an invalid number an appropriate way to prevent the entry from being deleted? or should the entry data set to null?http://s9y.org/116.html wrote: backend_delete_entry - Called when deleting an entry. Input data: Entry data
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
If you search the code for 'backend_delete_entry' you'll see that the hook gets executed with $id as $eventData before the DELETE SQL statements are set.
Thus, setting $id to "-1" or "0" would make all the DELETE statements not delete matching rows.
So, the answer is: Yes.
Best regards,
Garvin
If you search the code for 'backend_delete_entry' you'll see that the hook gets executed with $id as $eventData before the DELETE SQL statements are set.
Thus, setting $id to "-1" or "0" would make all the DELETE statements not delete matching rows.
So, the answer is: Yes.
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
soylentgreen
- Regular
- Posts: 28
- Joined: Sun Aug 20, 2006 2:54 pm
-
soylentgreen
- Regular
- Posts: 28
- Joined: Sun Aug 20, 2006 2:54 pm
here's the code
comments are welcome
please note that the plugin still allows to enter the editing / deleting screens, since i could not figure out a way to prevent that
comments are welcome
please note that the plugin still allows to enter the editing / deleting screens, since i could not figure out a way to prevent that