You are here

function hook_commons_profile_action_links_alter in Drupal Commons 6.2

Implementation of hook_commons_profile_action_links_alter()

Alter, or add to, the profile links residing under the profile image

Parameters

&$links: An array of links, passed by reference.

$account: The user whose profile is being view, NOT the current user.

2 functions implement hook_commons_profile_action_links_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

commons_notifications_commons_profile_action_links_alter in modules/features/commons_notifications/commons_notifications.module
Implementation of hook_commons_profile_action_links_alter()
commons_reputation_commons_profile_action_links_alter in modules/features/commons_reputation/commons_reputation.module
Implementation of hook_commons_profile_action_links_alter()
1 invocation of hook_commons_profile_action_links_alter()
_commons_profile_image_links_block_view in modules/features/commons_profile/commons_profile.blocks.inc
Generate the profile image and action links block

File

modules/features/commons_profile/commons_profile.api.php, line 13

Code

function hook_commons_profile_action_links_alter(&$links, $account) {
  global $user;

  // If we're viewing our own profile
  if ($user->uid == $account->uid) {

    // Add a link to view notification messages
    if (messaging_simple_access($account)) {

      // Count the available messages for this account
      $sql = "SELECT COUNT(uid) FROM {messaging_store} WHERE uid = %d";
      $count = db_result(db_query($sql, $account->uid));
      $links['notification_messages'] = array(
        'title' => t('Messages') . ($count > 0 ? " ({$count})" : ''),
        'href' => "user/{$account->uid}/messages",
      );
    }

    // Add a link to edit notification settings
    if (notifications_access_user($account)) {
      $links['notification_settings'] = array(
        'title' => t('Notification settings'),
        'href' => "user/{$account->uid}/notifications",
      );
    }
  }
}