As far as I know when an owner of an object is deleted the object is deleted as well. Same for the container of the object. However, we have a payment object that due to accounting requirements must not be deleted even if the payer or the container are deleted .
What is the recommended way to do this?
Thank you.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
As always, all the information is in the documentation.
- Reuven@reuven
Reuven - 0 likes
- Reuven@reuven
Reuven - 0 likes
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- Reuven@reuven
Reuven - 0 likes
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
- Reuven@reuven
Reuven - 0 likes
- iionly@iionly
iionly - 0 likes
- Reuven@reuven
Reuven - 0 likes
- Reuven@reuven
Reuven - 0 likes
You must log in to post replies.You can use permissions_check:delete hook.
Something like this:
Interesting approach. I'll try it.
BTW I forgot to mention that I use Elgg 2.3.16. But it has similar hook.
Thank you very much Nikolai.
Interesting approach. I'll try it.
BTW I forgot to mention that I use Elgg 2.3.16. But it has similar hook.
Thank you very much Nikolai.
http://learn.elgg.org/en/2.3/guides/hooks-list.html#permission-hooks
http://learn.elgg.org/en/2.3/guides/permissions-check.html
Very good.
Thank you Nikolai
depending on the design of the plugin and privacy issue maybe you could look into making the objects owned/contained by the Site. The site is never removed.
Sometimes this can be a solution.
The prevent deletion hook is an option. Keep in mind that maybe the Garbage collection plugin can still remove the objects. Check it out.
Thank you Jerome.
Yes, I also thought about this solution. It is simpler.
Can you guide me how to check this with the Garbage collection plugin?
Thanks a lot.
Or creating a user just for the purpose of transferring all content formerly owned by accounts to be deleted to. Maybe easier to handle it this way if the content is supposed to be accessible on site as some plugins might rather expect the owner being of type user and not site.
As for the garbage collection: the plugin searches the database for orphaned data (I think maybe mostly metadata/metastrings). If these database entries have an owner_id pointing to an entity no longer existing it gets removed. That's a rather short explanation (that might even in parts be wrong as I've not looked into the code to see what exactly is done). Anyway, the hook might not help to prevent deletion because the garbage collection would rather use raw MySQL code instead of making use of Elgg API functions (that would call the hooks).
Thank you iionly.
From your answer I understand Jerome's comment about the Garbage collection plugin. The prevent deletion hook can create orphans which may be deleted by the garbage collection. So, this approach is not recommended.
I do not understand this comment. Could you please explain it?
Do you think that making the objects owned/contained by the Site is not advisable?
Thank you very much.
We can put the owner and container in in metadata