diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-15 12:50:46 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-15 12:50:46 +0000 |
commit | 3fee9f5a389a476da6f2055ab6ac149652c0cf65 (patch) | |
tree | a2d0f36ccd02b567fda9a4afeb45eb833ce4d7c2 /engine/lib/users.php | |
parent | 624cab6eff69d43c70cacedf8fa2d8d9fa64fabd (diff) | |
download | elgg-3fee9f5a389a476da6f2055ab6ac149652c0cf65.tar.gz elgg-3fee9f5a389a476da6f2055ab6ac149652c0cf65.tar.bz2 |
Refs #617 put user validation functions back in users lib
git-svn-id: http://code.elgg.org/elgg/trunk@7321 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r-- | engine/lib/users.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php index c9a534b62..b22e93ca2 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1224,6 +1224,42 @@ function generate_invite_code($username) { } /** + * Set the validation status for a user. + * + * @param bool $status Validated (true) or false + * @param string $method Optional method to say how a user was validated + * @return bool + */ +function set_user_validation_status($user_guid, $status, $method = '') { + $result1 = create_metadata($user_guid, 'validated', $status, '', 0, ACCESS_PUBLIC, false); + $result2 = create_metadata($user_guid, 'validated_method', $method, '', 0, ACCESS_PUBLIC, false); + if ($result1 && $result2) { + return true; + } else { + return false; + } +} + +/** + * Trigger an event requesting that a user guid be validated somehow - either by email address or some other way. + * + * This function invalidates any existing validation value. + * + * @param int $user_guid User's GUID + */ +function request_user_validation($user_guid) { + $user = get_entity($user_guid); + + if (($user) && ($user instanceof ElggUser)) { + // invalidate any existing validations + set_user_validation_status($user_guid, false); + + // request validation + trigger_elgg_event('validate', 'user', $user); + } +} + +/** * Adds collection submenu items * * @return void |