From 4a92ecbc2d4ece4e2c2e5d0b7a7f8b2a6190a285 Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 13 Aug 2008 15:16:50 +0000 Subject: Closes #227. Depends on #243 to work. git-svn-id: https://code.elgg.org/elgg/trunk@1903 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/email/confirm.php | 7 +++++++ actions/register.php | 6 +++++- engine/lib/entities.php | 16 +++++++++------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/actions/email/confirm.php b/actions/email/confirm.php index 64c2c766a..39eb68908 100644 --- a/actions/email/confirm.php +++ b/actions/email/confirm.php @@ -14,6 +14,9 @@ global $CONFIG; // Get user id + $access_status = access_get_show_hidden_status(); + access_show_hidden_entities(true); + $user_guid = (int)get_input('u'); $user = get_entity($user_guid); @@ -26,6 +29,8 @@ system_message(elgg_echo('email:confirm:success')); $user = get_entity($user_guid); + $user->enable(); + notify_user($user_guid, $CONFIG->site->guid, sprintf(elgg_echo('email:validate:success:subject'), $user->username), sprintf(elgg_echo('email:validate:success:body'), $user->name), NULL, 'email'); } else @@ -33,6 +38,8 @@ } else register_error(elgg_echo('email:confirm:fail')); + + access_show_hidden_entities($access_status); forward($_SERVER['HTTP_REFERER']); exit; diff --git a/actions/register.php b/actions/register.php index 38d1893b9..059e69f50 100644 --- a/actions/register.php +++ b/actions/register.php @@ -39,15 +39,19 @@ ) && ($guid = register_user($username, $password, $name, $email)) ) { + + $new_user = get_entity($guid); if (($guid) && ($admin)) { admin_gatekeeper(); // Only admins can make someone an admin - $new_user = get_entity($guid); $new_user->admin = 'yes'; } // Send email validation on register only request_email_validation($guid); + + // Now disable + $new_user->disable('new_user'); system_message(sprintf(elgg_echo("registerok"),$CONFIG->sitename)); diff --git a/engine/lib/entities.php b/engine/lib/entities.php index dfb7492b0..31129fbad 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1466,8 +1466,8 @@ $guid = (int)$guid; $reason = sanitise_string($reason); - if ($entity = get_entity($guid)) { - if (trigger_elgg_event('delete',$entity->type,$entity)) { + if ($entity = get_entity($guid)) { + if (trigger_elgg_event('delete',$entity->type,$entity)) { if ($entity->canEdit()) { if ($reason) @@ -1740,18 +1740,20 @@ if ($entity = get_entity($entity_guid)) { + $return = false; + // Test user if possible - should default to false unless a plugin hook says otherwise if (!is_null($user)) { - if ($entity->getOwner() == $user->getGUID()) return true; - if ($entity->container_guid == $user->getGUID()) return true; - if ($entity->type == "user" && $entity->getGUID() == $user->getGUID()) return true; + if ($entity->getOwner() == $user->getGUID()) $return = true; + if ($entity->container_guid == $user->getGUID()) $return = true; + if ($entity->type == "user" && $entity->getGUID() == $user->getGUID()) $return = true; if ($container_entity = get_entity($entity->container_guid)) { - if ($container_entity->canEdit()) return true; + if ($container_entity->canEdit()) $return = true; } } - return trigger_plugin_hook('permissions_check',$entity->type,array('entity' => $entity, 'user' => $user),false); + return trigger_plugin_hook('permissions_check',$entity->type,array('entity' => $entity, 'user' => $user), $return); } else { return false; -- cgit v1.2.3