You are here

function user_relationships_can_request in User Relationships 7

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

Parameters

$requester: requesting user object

$relationship_type: relationship type object

Return value

TRUE if requester is allowed to request this type of relationship.

6 calls to user_relationships_can_request()
UserRelationshipsTestCase::testUserRelationshipsLoadDuplicates in ./user_relationships.test
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

... See full list

File

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

Code

function user_relationships_can_request($requester, $relationship_type = NULL) {

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