I created a plugin which includes a kind of discussion board. Some users of this forum are assigned as moderators (user->moderator metadata). I want this users to be able to delete other users postings. Each posting is saved as an object (subtype "posting"). So the following is my delete action:
require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php");
action_gatekeeper();
if(get_loggedin_user()->moderator){
global $is_admin;
$is_admin = TRUE;
}
$entity = get_entity(mypostingid);
$entity->delete();
$is_admin = FALSE;
I can see the entity when using print_r($entity). But I can't delete it. Any suggestions why? Does is_admin not allow me to delete entites from other users?
Thanks,
Peter
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.
- Brett@brett.profitt
Brett - 0 likes
- futurmat@futurmat
futurmat - 0 likes
You must log in to post replies.What version of Elgg are you using? $is_admin was deprecated by elgg_set_ignore_access(TRUE) in 1.6.
I'm using 1.6