Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using $profile = content_profile_load('profile', $account->uid);
I get the profile in the source translation.
Is there a way to directly load the content profile in the actual interface language.
I achieved it by
$profile = content_profile_load('profile', $account->uid);
if ($profile->language != $GLOBALS['language']->language and !empty($profile->tnid)) {
$translations = translation_node_get_translations($creator->tnid);
if (!empty($translations[$GLOBALS['language']->language])) {
$profile = node_load($translations[$GLOBALS['language']->language]->nid);
};};
But that way it needs two node loads and the profile is not cached, if I understand well.
Is there a better way to do it?
Right now I need the data in user-profile.tpl.php. But I might need it in node.tpl.php aswell.