/** * Unblocks $blocked_user as blocked by $blocking_user. * * @param ElggUser $blocked_user * @param ElggUser $blocking_user * @return bool */ function block_user(\ElggUser $blocked_user, \ElggUser $blocking_user) { if (!$blocked_user instanceof \ElggUser) { return false; } if ($blocking_user && !$blocking_user instanceof \ElggUser) { return false; } elseif (!$blocking_user) { $blocking_user = elgg_get_logged_in_user_entity(); } // can't block admins if ($blocked_user->isAdmin()) { return false; } return add_entity_relationship($blocking_user->getGUID(), 'blocked', $blocked_user->getGUID()); }