I've found that in elgg 1.8 is available the elgg_unregister_action function, but it isn't available in 1.7. So, what's the correct way to unregister an action?
I've come with this approach
if (isset($CONFIG->actions[$action])) {
unset($CONFIG->actions[$action]);
}
Or should I register the action with a new void action?
Is this a good way to prevent certain users to execute certain actions?
Thanks for your help in advance.
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.
- Matt Beckett@Beck24
Matt Beckett - 0 likes
You must log in to post replies.I think if there is no API method what you have there is fine.
Depending on the logic you want to do to prevent users doing the action, you can either unregister it globally for everyone, or put that in an if statement where you weed out who's not allowed to do it.
Or you can return false in the 'action',[action] plugin hook