You are here

function user_relationships_can_receive in User Relationships 7

Check whether a user is allowed to receive a certain relationship type.

Parameters

$requestee: Requesting user object.

$relationship_type: Relationship type for which should be checked. NULl to check for any.

Return value

TRUE if receiver is allowed to request this type of relationship

6 calls to user_relationships_can_receive()
user_relationships_get_requestable_rtypes in ./user_relationships.module
Get relationship types that a user can request from another user.
user_relationships_preprocess_author_pane in ./user_relationships.author-pane.inc
Implements hook_preprocess_author_pane().
user_relationships_request_relationship in ./user_relationships.module
Request a new user relationship
user_relationships_ui_check_access in user_relationships_ui/user_relationships_ui.module
Check access callback
user_relationships_ui_request_validate in user_relationships_ui/user_relationships_ui.actions.inc
Validate relationship request.

... See full list

File

./user_relationships.module, line 895
User Relationships API. Module shell.

Code

function user_relationships_can_receive($requestee, $relationship_type = NULL) {

  // Allow to by-pass the permission check.
  if (!empty($requestee->user_relationships_allow_all)) {
    return TRUE;
  }
  return user_relationships_user_access('can have @relationship relationships', $relationship_type, $requestee);
}