From 920d8c409b6bac1b8def6d05d7a90860b249ecd7 Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 3 Oct 2008 13:00:41 +0000 Subject: Refs #311 git-svn-id: https://code.elgg.org/elgg/trunk@2169 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/users.php | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'engine/lib/users.php') diff --git a/engine/lib/users.php b/engine/lib/users.php index 3bb1d0da8..48a05c12a 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -901,7 +901,7 @@ * @param int $user_guid The user id * @param string $email_address The email address */ - function generate_email_validation_code($user_guid, $email_address) + /*function generate_email_validation_code($user_guid, $email_address) { global $CONFIG; @@ -914,7 +914,7 @@ * @param int $user_guid The user * @param bool $status The status */ - function set_email_validation_status($user_guid, $status) + /*function set_email_validation_status($user_guid, $status) { $user_guid = (int)$user_guid; @@ -926,7 +926,7 @@ * * @param int $user_guid */ - function get_email_validation_status($user_guid) + /*function get_email_validation_status($user_guid) { $user = get_entity($user_guid); @@ -944,7 +944,7 @@ * @param int $user_guid The user. * @return bool */ - function request_email_validation($user_guid) + /*function request_email_validation($user_guid) { global $CONFIG; @@ -973,7 +973,7 @@ * @param int $user_guid User GUID * @param string $code The code provided on validation. */ - function validate_email($user_guid, $code) + /*function validate_email($user_guid, $code) { $user = get_entity($user_guid); @@ -984,6 +984,29 @@ return $valid; } + /** + * Trigger an event requesting that a user guid be validated somehow - either by email address or some other way. + * + * This event invalidates any existing values and returns + * + * @param unknown_type $user_guid + */ + function request_email_validation($user_guid) + { + $user = get_entity($user_guid); + + if (($user) && ($user instanceof ElggUser)) + { + // invalidate any existing validations + create_metadata($user_guid, 'validated', false,'', 0, 2); + create_metadata($user_guid, 'validated_method', '','', 0, 2); + + // request validation + trigger_elgg_event('user', 'validate', $user); + + } + } + /** * Validates an email address. * -- cgit v1.2.3