aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/users.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r--engine/lib/users.php27
1 files changed, 23 insertions, 4 deletions
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;
}
/**