diff options
-rw-r--r-- | engine/lib/metadata.php | 10 | ||||
-rw-r--r-- | engine/lib/users.php | 27 | ||||
-rw-r--r-- | mod/uservalidationbyemail/start.php | 7 |
3 files changed, 31 insertions, 13 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 8a19d847a..35ea073f0 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -216,7 +216,7 @@ $existing = get_data_row("SELECT * from {$CONFIG->dbprefix}metadata WHERE entity_guid = $entity_guid and name_id=" . add_metastring($name) . " limit 1");
if (($existing) && (!$allow_multiple) && (isset($value)))
- {
+ {
$id = $existing->id;
$result = update_metadata($id, $name, $value, $value_type, $owner_guid, $access_id);
@@ -256,7 +256,7 @@ $id = $existing->id;
delete_metadata($id);
- }
+ } return $id;
}
@@ -279,7 +279,7 @@ if (!$md = get_metadata($id)) return false;
if (!$md->canEdit()) return false;
-
+
// If memcached then we invalidate the cache for this entry
static $metabyname_memcache;
if ((!$metabyname_memcache) && (is_memcache_available()))
@@ -311,8 +311,8 @@ $name = add_metastring($name);
if (!$name) return false;
-
- // If ok then add it
+ + // If ok then add it
$result = update_data("UPDATE {$CONFIG->dbprefix}metadata set value_id='$value', value_type='$value_type', access_id=$access_id, owner_guid=$owner_guid where id=$id and name_id='$name'");
if ($result!==false) {
$obj = get_metadata($id);
diff --git a/engine/lib/users.php b/engine/lib/users.php index fd8c00073..e45223e54 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1003,11 +1003,30 @@ function set_user_validation_status($user_guid, $status, $method = '')
{
if (!$status) $method = '';
-
- create_metadata($user_guid, 'validated', $status,'', 0, ACCESS_PUBLIC);
- create_metadata($user_guid, 'validated_method', $method,'', 0, ACCESS_PUBLIC);
+ + if ($status) + {
+ if ( + (create_metadata($user_guid, 'validated', $status,'', 0, ACCESS_PUBLIC)) && + (create_metadata($user_guid, 'validated_method', $method,'', 0, ACCESS_PUBLIC)) + ) + return true; + } + else + { + $validated = get_metadata_byname($user_guid, 'validated'); + $validated_method = get_metadata_byname($user_guid, 'validated_method'); + + if ( + ($validated) && + ($validated_method) && + (delete_metadata($validated->id)) && + (delete_metadata($validated_method->id)) + ) + return true; + }
- return true;
+ return false;
}
/**
diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index deadc0afb..a990843d6 100644 --- a/mod/uservalidationbyemail/start.php +++ b/mod/uservalidationbyemail/start.php @@ -89,11 +89,10 @@ { $user = get_entity($user_guid); - $valid = ($code == uservalidationbyemail_generate_code($user_guid, $user->email)); - if ($valid) - set_user_validation_status($user_guid, true, 'email'); + if ($code == uservalidationbyemail_generate_code($user_guid, $user->email)) + return set_user_validation_status($user_guid, true, 'email'); - return $valid; + return false; } // Initialise |