How can I access fields values inside profile2 main profile? Only on edit main profile page? I try to hide a field on profile2 edit page based on another value. Code is from my template.php
and then calling
global $user; $profile = profile2_load_by_user($user->uid, 'main'); $checkbox1 = $profile->field_checkbox_admin1['und']['value'];
The problem is that profile variable is not accessible if all of the fields in profile are empty. dpm($profile) shows nothing and I get undefined variable error.