Index: branches/5.3.x/core/units/user_profile/user_profile_tp.php =================================================================== diff -u -N -r15698 -r16395 --- branches/5.3.x/core/units/user_profile/user_profile_tp.php (.../user_profile_tp.php) (revision 15698) +++ branches/5.3.x/core/units/user_profile/user_profile_tp.php (.../user_profile_tp.php) (revision 16395) @@ -1,6 +1,6 @@ SelectParam($params, 'name,field'); $profile_mapping = $this->Application->getUnitConfig('u')->getUserProfileMapping(); $user_field = array_key_exists($field, $profile_mapping) ? $profile_mapping[$field] : false; - if (array_key_exists('profile_field', $params) && $params['profile_field']) { - // get variable from mapping - $params['name'] = $user_field; - $value = $this->Application->ProcessParsedTag('u.profile', 'Field', $params); + // Get field value to show on "Public Profile" page. + if ( array_key_exists('profile_field', $params) && $params['profile_field'] ) { + if ( $user_field ) { + $params['name'] = $user_field; + } + + return $this->Application->ProcessParsedTag('u.profile', 'Field', $params); } - elseif ($user_field) { - // old style variable for displaying fields in public profile (named "pp_*") - $block_params = Array ('name' => 'DisplayToPublic', 'value' => $user_field); - $value = $this->Application->ProcessParsedTag($this->getUserPrefixSpecial(), 'Selected', $block_params); + + if ( $user_field ) { + // Determine if field should be shown on "Public Profile" page (always checkbox). + $block_params = array('name' => 'DisplayToPublic', 'value' => $user_field); + $selected = $this->Application->ProcessParsedTag( + $this->getUserPrefixSpecial(), + 'Selected', + $block_params + ); + $value = $selected ? 1 : 0; } else { - // get variable by name + // Custom user preference (can by field of any type) - fallback to persistent session storage. $value = $this->recallUserProfileVar($field); + $selected = $value == 1; } - if (isset($params['checked']) && $params['checked']) { - $checked_value = isset($params['value']) ? $params['value'] : 1; - $value = ($value == $checked_value) ? 'checked' : ''; + if ( isset($params['checked']) && $params['checked'] ) { + return $selected ? 'checked' : ''; } return $value; @@ -142,4 +158,4 @@ return parent::prepareInputName($params); } - } \ No newline at end of file + }