/** * Register an option for the user. * This function registers the option value in the database and in the current user options * * @param string $name The option name, formatted as '<plugin>.<key>' * @param mixed $value The value to set to the option */ public function setOption($name, $value) { $this->getOptions(); $this->options[$name] = $value; list($plugin, $key) = explode('.', $name, 2); $data = array('plugin' => $plugin, 'key' => $key, 'value' => $value); if ($this->isLogged()) { $data['userId'] = $this->id; } else { $data['userIp'] = App::request()->clientIp(); } UserOption::getDbInstance()->replace(UserOption::getTable(), $data); }