You are here

function notifications_user_user_view in Notifications 7

Implements hook_user_view().

File

notifications_user/notifications_user.module, line 172
Notifications module - User subscriptions tabs

Code

function notifications_user_user_view($account) {
  $list = new Notifications_Subscription_List();
  if (user_access('subscribe to author')) {
    if (notifications_subscription_type('user_content', 'user_links') && notifications_subscription_type_enabled('user_content')) {
      $list
        ->add(notifications_subscription('user_content')
        ->set_author($account));
    }

    // @todo Add here subscriptions to content type x author if enabled
  }
  if ($list
    ->count()) {
    $list
      ->set_user($GLOBALS['user']);
    $account->content['summary']['notifications'] = array(
      '#type' => 'user_profile_item',
      '#title' => t('Subscriptions'),
      '#markup' => theme('item_list', array(
        'items' => $list
          ->get_links(),
      )),
      '#attributes' => array(
        'class' => array(
          'notifications',
        ),
      ),
    );
  }
}