src/Model/Admin.php
protected function setUnsetAdminData($key, $value, $userId, $set)
    {
        //  Get the user ID
        $userId = $this->adminDataGetUserId($userId);

        //  Get the existing data for this user
        $existing = $this->getAdminData(null, $userId);

        if ($set) {

            //  Set the new key
            if (in_array($key, $this->aJsonFields)) {
                $value = json_encode($value);
            }
            $existing[$key] = $value;

        } else {

            //  Unset the existing key
            $existing[$key] = null;
        }

        //  Save to the DB
        $bResult = $this->oUserMetaService->update(
            NAILS_DB_PREFIX . 'user_meta_admin',
            $userId,
            $existing
        );
    }
protected function setUnsetAdminData($key, $value, $userId, $set)
    {
        //  Get the user ID
        $userId = $this->adminDataGetUserId($userId);

        //  Get the existing data for this user
        $existing = $this->getAdminData(null, $userId);

        if ($set) {

            //  Set the new key
            if (in_array($key, $this->aJsonFields)) {
                $value = json_encode($value);
            }
            $existing[$key] = $value;

        } else {

            //  Unset the existing key
            $existing[$key] = null;
        }

        //  Save to the DB
        $bResult = $this->oUserMetaService->update(
            NAILS_DB_PREFIX . 'user_meta_admin',
            $userId,
            $existing
        );
    }
Handles the setting and unsetting of admin data

@param  string  $key    The key to set
@param  mixed   $value  The value to set
@param  mixed   $userId The user's ID, if null active user is used.
@param  boolean $set    Whether the data is being set or unset

@return boolean