문제

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.

다른 팁

<?php

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 drupal.stackexchange
scroll top