getProfileMapping(); $field = $this->SelectParam($params, 'name,field'); if (isset($params['profile_field']) && $params['profile_field']) { $params['name'] = $profile_mapping[$field]; $value = $this->Application->ProcessParsedTag('u.profile', 'Field', $params); } else { $profile_user_id = $this->Application->GetVar('user_id'); if (!$profile_user_id) { // if none user_id given use current user id $profile_user_id = $this->Application->RecallVar('user_id'); } $value = $this->recallUserProfileVar($profile_user_id, $field); } if (isset($params['checked']) && $params['checked']) { $checked_value = isset($params['value']) ? $params['value'] : 1; $value = ($value == $checked_value) ? 'checked' : ''; } return $value; } /** * Allows to get persistent var from other user * * @param int $user_id * @param string $var_name * @return mixed */ function recallUserProfileVar($user_id, $var_name) { static $cached_vars = null; if (!isset($cached_vars)) { $sql = 'SELECT VariableValue, VariableName FROM '.TABLE_PREFIX.'PersistantSessionData WHERE (PortalUserId = '.$user_id.') AND (LENGTH(VariableValue) < 10)'; $cached_vars = $this->Conn->GetCol($sql, 'VariableName'); } return isset($cached_vars[$var_name]) ? $cached_vars[$var_name] : false; } /** * Returns mapping between persistent var name and user profile field * * @return Array */ function getProfileMapping() { $profile_mapping = Array ( 'pp_firstname' => 'FirstName', 'pp_lastname' => 'LastName', 'pp_dob' => 'dob', 'pp_email' => 'Email', 'pp_phone' => 'Phone', 'pp_street' => 'Street', 'pp_city' => 'City', 'pp_state' => 'State', 'pp_zip' => 'Zip', 'pp_country' => 'Country', ); return $profile_mapping; } } ?>