You are here

function photos_user_view in Album Photos 7.3

Same name and namespace in other branches
  1. 8.5 photos.module \photos_user_view()
  2. 8.4 photos.module \photos_user_view()
  3. 6.0.x photos.module \photos_user_view()

Implements hook_user_view().

File

./photos.module, line 881
Implementation of photos.module.

Code

function photos_user_view($account, $view_mode, $langcode) {
  global $user;
  if (user_access('view photo') || user_access('create photo', $account)) {
    $item = array();
    if ($account->album['album']['count']) {
      $item[] = l(t('There are !a albums in total', array(
        '!a' => $account->album['album']['count'],
      )), 'photos/user/' . $account->uid . '/album');
    }
    elseif ($account->uid == $user->uid) {
      $item[] = t('No albums yet') . ', ' . l(t('Create album'), 'node/add/photos');
    }
    if ($account->album['image']['count']) {
      $item[] = l(t('There are !a images in total', array(
        '!a' => $account->album['image']['count'],
      )), 'photos/user/' . $account->uid . '/image');
    }
    elseif ($account->uid == $user->uid) {
      $item[] = t('No images yet') . ', ' . l(t('Upload images'), 'photos/upload');
    }
    if (variable_get('photos_slide', 0) && $account->album['image']['count'] && module_exists('dfgallery')) {
      $item[] = l(t('Slideshow'), 'photos/user/' . $account->uid . '/slide');
    }
    if (isset($item[0])) {
      $account->content['summary']['photos'] = array(
        '#type' => 'user_profile_item',
        '#title' => t('Album image'),
        '#markup' => theme('item_list', array(
          'items' => $item,
        )),
        '#attributes' => array(
          'class' => 'photos',
        ),
      );
    }
  }
}