In Drupal 7, I am using Profile2 (7.x-1.0-beta1) module to add custom fields like 'Author Name' etc to an user's profile page. How do I pull those custom fields in a view (7.x-3.x-dev)? All other custom CCK fields shows up in a view's selection list but not those added to an user profile page.


I fail to understand why anyone would use Profile2 (or Content profile) when users in Drupal 7 are fieldable.

From what I understand from the Profile 2 project page, it utilizes Entity API; you may need to use EntityFieldQuery Views Backend.

  • 1
    Profiles 2 allows for users to have registration paths and fields associated with that path. Also it allows for different fields based on rolls. Much more powerful than the standard methods that are out of box. Thank you for entity field views. – user21501 Oct 2 '13 at 18:22

global $user;

$uid = user_load($user->uid);
$profile = profile2_load_by_user($uid, 'showmember_profile');

//laod specific fields from the profile2 showmember
echo $profile->field_firstname['und'][0]['value'];
echo $profile->field_lastname['und'][0]['value'];
echo $profile->field_cityname['und'][0]['value'];
echo $profile->field_phone['und'][0]['value'];


Check for user permissions for the particular role that the user belongs to. check if that role has permissions to view the profile of itself and any other user. To check that go to People >> Permissions section.

protected by kiamlaluno Oct 2 '13 at 19:01

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.