UserModel::savePreference PHP Method

savePreference() public method

This is a convenience method that uses $this->SaveToSerializedColumn().
public savePreference ( integer $UserID, mixed $Preference, mixed $Value = '' )
$UserID integer The UserID to save.
$Preference mixed The name of the preference being saved, or an associative array of name => value pairs to be saved. If this is an associative array, the $Value argument will be ignored.
$Value mixed The value being saved.
    public function savePreference($UserID, $Preference, $Value = '')
    {
        // Make sure that changes to the current user become effective immediately.
        $Session = Gdn::session();
        if ($UserID == $Session->UserID) {
            $Session->setPreference($Preference, $Value, false);
        }
        return $this->saveToSerializedColumn('Preferences', $UserID, $Preference, $Value);
    }
UserModel