diff options
-rw-r--r-- | engine/classes/ElggPlugin.php | 4 | ||||
-rw-r--r-- | engine/classes/ElggWidget.php | 8 | ||||
-rw-r--r-- | engine/lib/users.php | 22 |
3 files changed, 18 insertions, 16 deletions
diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php index 1b9be3ec1..731875755 100644 --- a/engine/classes/ElggPlugin.php +++ b/engine/classes/ElggPlugin.php @@ -765,7 +765,7 @@ class ElggPlugin extends ElggObject { // No, so see if its in the private data store. // get_private_setting() returns false if it doesn't exist - $meta = get_private_setting($this->guid, $name); + $meta = $this->getPrivateSetting($name); if ($meta === false) { // Can't find it, so return null @@ -794,7 +794,7 @@ class ElggPlugin extends ElggObject { return true; } else { - return set_private_setting($this->guid, $name, $value); + return $this->setPrivateSetting($name, $value); } } diff --git a/engine/classes/ElggWidget.php b/engine/classes/ElggWidget.php index 913dfc2ba..dae61de68 100644 --- a/engine/classes/ElggWidget.php +++ b/engine/classes/ElggWidget.php @@ -35,7 +35,7 @@ class ElggWidget extends ElggObject { } // No, so see if its in the private data store. - $meta = get_private_setting($this->guid, $name); + $meta = $this->getPrivateSetting($name); if ($meta) { return $meta; } @@ -61,7 +61,7 @@ class ElggWidget extends ElggObject { $this->attributes[$name] = $value; } else { - return set_private_setting($this->guid, $name, $value); + return $this->setPrivateSetting($name, $value); } return true; @@ -75,7 +75,7 @@ class ElggWidget extends ElggObject { * @since 1.8.0 */ public function setContext($context) { - return set_private_setting($this->guid, 'context', $context); + return $this->setPrivateSetting('context', $context); } /** @@ -85,7 +85,7 @@ class ElggWidget extends ElggObject { * @since 1.8.0 */ public function getContext() { - return get_private_setting($this->guid, 'context'); + return $this->getPrivateSetting('context'); } /** diff --git a/engine/lib/users.php b/engine/lib/users.php index 84e5fcc7b..567f587ea 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -685,8 +685,8 @@ function send_new_password_request($user_guid) { if ($user) { // generate code $code = generate_random_cleartext_password(); - //create_metadata($user_guid, 'conf_code', $code, '', 0, ACCESS_PRIVATE); - set_private_setting($user_guid, 'passwd_conf_code', $code); + $user->setPrivateSetting('passwd_conf_code', $code); + // generate link $link = $CONFIG->site->url . "pg/resetpassword?u=$user_guid&c=$code"; @@ -744,18 +744,20 @@ function execute_new_password_request($user_guid, $conf_code) { $user_guid = (int)$user_guid; $user = get_entity($user_guid); - $saved_code = get_private_setting($user_guid, 'passwd_conf_code'); + if ($user) { + $saved_code = $user->getPrivateSetting('passwd_conf_code'); - if ($user && $saved_code && $saved_code == $conf_code) { - $password = generate_random_cleartext_password(); + if ($saved_code && $saved_code == $conf_code) { + $password = generate_random_cleartext_password(); - if (force_user_password_reset($user_guid, $password)) { - remove_private_setting($user_guid, 'passwd_conf_code'); + if (force_user_password_reset($user_guid, $password)) { + remove_private_setting($user_guid, 'passwd_conf_code'); - $email = elgg_echo('email:resetpassword:body', array($user->name, $password)); + $email = elgg_echo('email:resetpassword:body', array($user->name, $password)); - return notify_user($user->guid, $CONFIG->site->guid, - elgg_echo('email:resetpassword:subject'), $email, NULL, 'email'); + return notify_user($user->guid, $CONFIG->site->guid, + elgg_echo('email:resetpassword:subject'), $email, NULL, 'email'); + } } } |