You are here

user.inc in Notifications 6.4

Same filename and directory in other branches
  1. 7 includes/user.inc

Notifications node API for use by plug-in modules providing user related features

So far, this is used by:

  • notifications_content
  • notifications_feed

File

includes/user.inc
View source
<?php

/**
 * @file
 * Notifications node API for use by plug-in modules providing user related features
 * 
 * So far, this is used by:
 * - notifications_content
 * - notifications_feed
 */

/**
 * Wrapper for author autocomplete callback.
 *
 * @param $uid
 *   uid of the user for which to return the name.
 * @param $subs_type
 *   Optional type of subscription for which to find allowed content types. Defaults to nodetype, can be any subscription type with event-type=node for which notifications_content handles content type settings.
 */
function notifications_user_name_callback($uid, $subs_type = '') {
  return messaging_user_format_name($uid);
}
function notifications_user_name2uid($name, $field = NULL) {
  if ($account = user_load(array(
    'name' => $name,
  ))) {
    return $account->uid;
  }
  elseif ($field) {
    form_set_error($field, t('User name not found.'));
  }
}

/**
 * Check user access to user
 * 
 * @param $user
 *   Target user account to check access to
 * @param $account
 *   User account who wants to access
 */
function notifications_user_user_access($user, $account) {
  return $user && $user->uid && ($user->uid == $account->uid || user_access('administer users', $account) || $user->access && $user->status && user_access('access user profiles', $account));
}

Functions

Namesort descending Description
notifications_user_name2uid
notifications_user_name_callback Wrapper for author autocomplete callback.
notifications_user_user_access Check user access to user