You are here

function uc_file_user_view in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_file/uc_file.module \uc_file_user_view()
  2. 6.2 uc_file/uc_file.module \uc_file_user_view()

Implements hook_user_view().

File

uc_file/uc_file.module, line 360
Allows products to be associated with downloadable files.

Code

function uc_file_user_view($account, $view_mode) {
  global $user;

  // If user has files and permission to view them, put a link
  // on the user's profile.
  $existing_download = db_query("SELECT fid FROM {uc_file_users} WHERE uid = :uid", array(
    ':uid' => $account->uid,
  ))
    ->fetchField();
  if (!$existing_download || !user_access('view all downloads') && $user->uid != $account->uid) {
    return;
  }
  $item = array(
    '#type' => 'user_profile_item',
    '#title' => t('File downloads'),
    '#markup' => l(t('Click here to view your file downloads.'), 'user/' . $account->uid . '/purchased-files'),
  );
  $account->content['summary']['uc_file_download'] = $item;
}