protected function reloadLiveUser($id = null) { if (is_null($id)) { $id = $this->get('id'); } $this->find_by_id($id); $this->activityprefs = load_activity_preferences($id); $this->accountprefs = load_account_preferences($id); $this->load_views(); }
/** * Returns an object containing information about a user, including account * and activity preferences * * @param int $userid The ID of the user to retrieve information about * @return object The user object. Note this is not in the same form as * the $USER object used to denote the current user - * the object returned by this method is a simple object. */ function get_user($userid) { if (!($user = get_record('usr', 'id', $userid, null, null, null, null, '*, ' . db_format_tsfield('expiry') . ', ' . db_format_tsfield('lastlogin')))) { throw new InvalidArgumentException('Unknown user ' . $userid); } $user->activityprefs = load_activity_preferences($userid); $user->accountprefs = load_account_preferences($userid); return $user; }