You are here

function _user_relationships_set_notifications in User Relationships 5.2

Same name and namespace in other branches
  1. 5 user_relationships.module \_user_relationships_set_notifications()
1 call to _user_relationships_set_notifications()
user_relationships_user in ./user_relationships_hooks.inc
User

File

./user_relationships.module, line 99

Code

function _user_relationships_set_notifications(&$account) {
  global $user;

  //only do this for the active user
  if ($account->uid != $user->uid) {
    return;
  }
  $notifications = drupal_get_messages('status', FALSE);
  $notifications = $notifications['status'] ? $notifications['status'] : array();
  $relationships = user_relationships_load(array(
    'requestee_id' => $account->uid,
    'approved' => FALSE,
  ));
  foreach ($relationships as $relationship) {
    $msg = user_relationships_get_message('pending', $relationship, array(
      '!pending_relationship_requests' => l(t('pending relationship requests'), "user/{$account->uid}/relationships/requests"),
    ));
    if (!in_array($msg, $notifications)) {
      drupal_set_message($msg);
    }
  }
}