Elgg\Database\AccessCollections::removeUser PHP Method

removeUser() public method

Triggers the 'access:collections:remove_user', 'collection' plugin hook.
public removeUser ( integer $user_guid, integer $collection_id ) : boolean
$user_guid integer The user GUID
$collection_id integer The access collection ID
return boolean
    function removeUser($user_guid, $collection_id)
    {
        $collection_id = (int) $collection_id;
        $user_guid = (int) $user_guid;
        $user = get_user($user_guid);
        $collection = $this->get($collection_id);
        if (!$user instanceof ElggUser || !$collection) {
            return false;
        }
        $params = array('collection_id' => $collection_id, 'user_guid' => $user_guid);
        if (!$this->hooks->trigger('access:collections:remove_user', 'collection', $params, true)) {
            return false;
        }
        $db = $this->db;
        $prefix = $db->prefix;
        $q = "DELETE FROM {$prefix}access_collection_membership\n\t\t\tWHERE access_collection_id = {$collection_id}\n\t\t\t\tAND user_guid = {$user_guid}";
        return (bool) $db->deleteData($q);
    }