i am writing a simple multistep form using ctools on drupal 7. Everything seems to work but i have a one last problem before i finish the task. How can i access the custom user fields (or fieldset i am not sure about the terminology). I've tried to do that by using the function below but it doesn't works and the property is always empty;
function helper_get_default_value_from_profile($fieldset, $key){
$uid = helper_is_user_logged_in();
$account = user_load($uid);
$profile = profile2_load_by_user($account, "cv");
if(!property_exists($profile, $fieldset))
return 0;
if(empty($profile->$fieldset))
return 0;
$fieldset_ref = $profile->$fieldset;
$id = $fieldset_ref["und"][0]["value"];
$fieldset_data = field_collection_field_get_entity($id);
if(!property_exists($fieldset_data, $key))
return 0;
if(empty($fieldset_data->$key))
return 0;
$user_prop = $fieldset_data->$key;
return $user_prop["und"][0]["value"];
}