Is it possible to render one of Profile2 fields elswhere on the page, in some node ?

I would like to present user with opportunity to edit only one field on custom link or node.


1 Answer 1


Retrieve Profile2 Profile Data Programmatically

  • Implement profile2_by_uid_load() to get the data.

    $profile2_data = profile2_by_uid_load($user->uid, 'profile_id');

$profile2_data will be an object containing all the data from profile_id for the requested user.

Retrieve Profile2 Edit Form Programmatically

module_load_include('inc', 'profile2_page', 'profile2_page');
$profile2 = profile2_by_uid_load($user->uid, 'profile_id');   // profile_id = machine name
$entity_form = entity_ui_get_form('profile2', $profile2, 'edit');
return $entity_form;
  • Credit: drupal.stackexchange.com/a/125144/1082 Sep 29, 2015 at 5:48
  • 1
    When I did: module_load_include('inc', 'profile2_page', 'profile2_page'); $profile2 = profile2_by_uid_load($user->uid, 'profile_id'); - I got function undefined - even though that module_load_include is meant to bring the function into scope. I used a different function as so: $profile = profile2_load_by_user($user_from_csv->uid, 'main'); which worked on its own (without the module_load_include). This profile2_load_by_user function that I used belongs to the profile2 module rather than the Sep 29, 2015 at 6:03
  • Credit: drupal.stackexchange.com/a/125144/1082 Sep 29, 2015 at 6:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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