/** * Allow non user to remove their registration correctly * * {@inheritdoc} */ public function canEdit($user_guid = 0) { global $EVENT_MANAGER_UNDO_REGISTRATION; if (!empty($EVENT_MANAGER_UNDO_REGISTRATION)) { return true; } return parent::canEdit($user_guid); }
function threads_create($guid, $params) { if (empty($guid)) { $topic = new ElggObject(); $topic->subtype = 'groupforumtopic'; } else { // load original file object $topic = new ElggObject($guid); if (!$topic || !$topic->canEdit()) { register_error(elgg_echo('discussion:topic:notfound')); forward(REFERER); } } // save parameters foreach ($params as $key => $value) { $topic->{$key} = $value; } return $topic->save(); }
if (!$container || !$container->canWriteToContainer(0, 'object', 'groupforumtopic')) { register_error(elgg_echo('discussion:error:permissions')); forward(REFERER); } // check whether this is a new topic or an edit $new_topic = true; if ($guid > 0) { $new_topic = false; } if ($new_topic) { $topic = new ElggObject(); $topic->subtype = 'groupforumtopic'; } else { // load original file object $topic = new ElggObject($guid); if (!$topic || !$topic->canEdit()) { register_error(elgg_echo('discussion:topic:notfound')); forward(REFERER); } } $topic->title = $title; $topic->description = $desc; $topic->status = $status; $topic->access_id = $access_id; $topic->container_guid = $container_guid; $tags = explode(",", $tags); $topic->tags = $tags; $result = $topic->save(); if (!$result) { register_error(elgg_echo('discussion:error:notsaved')); forward(REFERER);