You are here

function linkedin_profile_display_access in LinkedIn Integration 7

Same name and namespace in other branches
  1. 6 linkedin_profile/linkedin_profile.module \linkedin_profile_display_access()
2 calls to linkedin_profile_display_access()
linkedin_profile_block_view in linkedin_profile/linkedin_profile.module
linkedin_profile_user_view in linkedin_profile/linkedin_profile.module
Implements hook_user_view().
1 string reference to 'linkedin_profile_display_access'
linkedin_profile_menu in linkedin_profile/linkedin_profile.module

File

linkedin_profile/linkedin_profile.module, line 48

Code

function linkedin_profile_display_access($account) {
  if (variable_get('linkedin_profile_user_page_enabled', 0) < 1) {
    return FALSE;
  }
  if (!user_access('display LinkedIn profile', $account)) {
    return FALSE;
  }
  if (!isset($account->data['linkedin_profile_user_page_enabled']) || $account->data['linkedin_profile_user_page_enabled'] != 1) {
    return FALSE;
  }
  global $user;
  if (!user_access('access user profiles') && $user->uid != $account->uid) {
    return FALSE;
  }
  $check = linkedin_get_profile_fields($account->uid, array(
    'id',
  ));
  if (isset($check['error-code'])) {

    // no need to display an empty tab
    return FALSE;
  }
  return TRUE;
}