function user_relationships_ui_title_callback_pending in User Relationships 7
Title callback to display the amount of pending requests.
Parameters
$column: Which column that should be checked: requester_id (sent) or requestee_id (received).
$account: For which account shall the title be displayed. Defaults to the current user.
Return value
Title string for either the Sent or Received requests local tasks.
1 string reference to 'user_relationships_ui_title_callback_pending'
- user_relationships_ui_menu in user_relationships_ui/
user_relationships_ui.module - Implements hook_menu().
File
- user_relationships_ui/
user_relationships_ui.module, line 437 - UI components of user_relationships @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217 @author Darren Ferguson (contributor) http://drupal.org/user/70179
Code
function user_relationships_ui_title_callback_pending($column, $account = NULL) {
if (!$account || !is_object($account)) {
global $user;
$account = $user;
}
$count = user_relationships_load(array(
$column => $account->uid,
'approved' => FALSE,
), array(
'count' => TRUE,
));
if ($column == 'requester_id') {
if ($count > 0) {
return format_plural($count, 'Sent requests (1)', 'Sent requests (@count)');
}
return t('Sent requests');
}
else {
if ($count > 0) {
return format_plural($count, 'Received requests (1)', 'Received requests (@count)');
}
return t('Received requests');
}
}