aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/users.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-19 11:45:38 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-19 11:45:38 +0000
commit961e31c8833220e85b5c73651576642101a94b15 (patch)
treeafdfeedf3c2daece0d20fd7e78c71a88bc2bd1a6 /engine/lib/users.php
parent4dc9076224a0d93f0dc078124aa9fb94a669f16c (diff)
downloadelgg-961e31c8833220e85b5c73651576642101a94b15.tar.gz
elgg-961e31c8833220e85b5c73651576642101a94b15.tar.bz2
Closes #617 core has get and set functions for user validation status
git-svn-id: http://code.elgg.org/elgg/trunk@7344 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r--engine/lib/users.php44
1 files changed, 41 insertions, 3 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index b22e93ca2..62f2bdcc8 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1226,11 +1226,13 @@ 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
+ * @param int $user_guid The user's GUID
+ * @param bool $status Validated (true) or unvalidated (false)
+ * @param string $method Optional method to say how a user was validated
* @return bool
+ * @since 1.8.0
*/
-function set_user_validation_status($user_guid, $status, $method = '') {
+function elgg_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) {
@@ -1241,13 +1243,49 @@ function set_user_validation_status($user_guid, $status, $method = '') {
}
/**
+ * Gets the validation status of a user.
+ *
+ * @param int $user_guid The user's GUID
+ * @return bool|null Null means status was not set for this user.
+ * @since 1.8.0
+ */
+function elgg_get_user_validation_status($user_guid) {
+ $md = get_metadata_byname($user_guid, 'validated');
+ if ($md == false) {
+ return;
+ }
+
+ if ($md->value) {
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * 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
+ * @deprecated 1.8
+ */
+function set_user_validation_status($user_guid, $status, $method = '') {
+ elgg_deprecated_notice("set_user_validation_status() is deprecated", 1.8);
+ return elgg_set_user_validation_status($user_guid, $status, $method);
+}
+
+/**
* 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
+ * @deprecated 1.8
*/
function request_user_validation($user_guid) {
+ elgg_deprecated_notice("request_user_validation() is deprecated.
+ Plugins should register for the 'register, user' plugin hook", 1.8);
$user = get_entity($user_guid);
if (($user) && ($user instanceof ElggUser)) {