/** * {@inheritdoc} */ public function __set($name, $value) { if (array_key_exists($name, $this->attributes)) { switch ($name) { case 'prev_last_action': case 'last_login': case 'prev_last_login': if ($value !== null) { $this->attributes[$name] = (int) $value; } else { $this->attributes[$name] = null; } break; default: parent::__set($name, $value); break; } } else { parent::__set($name, $value); } }
/** * {@inheritdoc} */ public function __set($name, $value) { if (!array_key_exists($name, $this->attributes)) { parent::__set($name, $value); return; } switch ($name) { case 'prev_last_action': case 'last_login': case 'prev_last_login': if ($value !== null) { $this->attributes[$name] = (int) $value; } else { $this->attributes[$name] = null; } break; case 'salt': case 'password': elgg_deprecated_notice("Setting salt/password directly is deprecated. Use ElggUser::setPassword().", "1.10"); $this->attributes[$name] = $value; // this is emptied so that the user is not left with two usable hashes $this->attributes['password_hash'] = ''; break; // setting this not supported // setting this not supported case 'password_hash': _elgg_services()->logger->error("password_hash is now an attribute of ElggUser and cannot be set."); return; break; default: parent::__set($name, $value); break; } }
/** * Need to catch attempts to make a user an admin. Remove for 1.9 * * @param string $name Name * @param mixed $value Value * * @return bool */ public function __set($name, $value) { if ($name == 'admin' || $name == 'siteadmin') { elgg_deprecated_notice('The admin/siteadmin metadata are not longer used. Use ElggUser->makeAdmin() and ElggUser->removeAdmin().', 1.7); if ($value == 'yes' || $value == '1') { $this->makeAdmin(); } else { $this->removeAdmin(); } } return parent::__set($name, $value); }
/** * {@inheritdoc} */ public function __set($name, $value) { if (!array_key_exists($name, $this->attributes)) { parent::__set($name, $value); return; } switch ($name) { case 'prev_last_action': case 'last_login': case 'prev_last_login': if ($value !== null) { $this->attributes[$name] = (int) $value; } else { $this->attributes[$name] = null; } break; case 'salt': case 'password': _elgg_services()->logger->error("User entities no longer contain salt/password"); break; // setting this not supported // setting this not supported case 'password_hash': _elgg_services()->logger->error("password_hash is a readonly attribute."); break; default: parent::__set($name, $value); break; } }