How to render full profile2? I am tring to load a full profile2.
I a trying the following code
&lt;?php 
$uid = user_load($node-&gt;uid);
$profile2_p = profile2_load_by_user($uid, 'profile2_profile');
print render($profile2_p);
?&gt;

I get an error saying object can't be used as array.
If I print_r $profile2_p then I get an array relating to the correct profile2 entity. How can I render this entity?
Thanks
Looks like you can get a renderable array using profile2_view():
/**
 * View a profile.
 *
 * @see Profile::view()
 */
function profile2_view($profile, $view_mode = 'full', $langcode = NULL, $page = NULL) {
  return $profile-&gt;view($view_mode, $langcode, $page);
}


https://git.drupalcode.org/project/profile2/-/blob/7.x-1.x/profile2.module#L1084
See also that modules hook_user_view() which does the same:
https://git.drupalcode.org/project/profile2/-/blob/7.x-1.x/profile2.module#L399
/**
 * Implements hook_user_view().
 */
function profile2_user_view($account, $view_mode, $langcode) {
  foreach (profile2_get_types() as $type =&gt; $profile_type) {
    if ($profile_type-&gt;userView &amp;&amp; $profile = profile2_load_by_user($account, $type)) {
      if (profile2_access('view', $profile)) {
        $account-&gt;content['profile_' . $type] = array(
          '#type' =&gt; 'user_profile_category',
          '#title' =&gt; $profile_type-&gt;getTranslation('label'),
          '#prefix' =&gt; '&lt;a id=&quot;profile-' . $profile-&gt;type . '&quot;&gt;&lt;/a&gt;',
        );
        $account-&gt;content['profile_' . $type]['view'] = $profile-&gt;view($view_mode);
      }
    }
  }
}

With a single entity in your code, you can:
render($profile2_p-&gt;view($some_view_mode));