Browse Source

[svn r22540] Fixed extra information into my shared profile - see FS#4447

Cristian Fasanando 15 years ago
parent
commit
7d054bf637
1 changed files with 36 additions and 4 deletions
  1. 36 4
      main/social/profile.php

+ 36 - 4
main/social/profile.php

@@ -701,17 +701,49 @@ echo '<div id="social-profile-container">';
     	  	}*/
 
     	  	if ($show_full_profile) {    	  		
-				//-- Extra Data							
+				//-- Extra Data
+				$t_uf = Database :: get_main_table(TABLE_MAIN_USER_FIELD);
+				$t_ufo = Database :: get_main_table(TABLE_MAIN_USER_FIELD_OPTIONS);
 				$extra_user_data = UserManager::get_extra_user_data($user_id);
 				if (is_array($extra_user_data) && count($extra_user_data)>0 ) {
 					echo '<div class="sectiontitle">';
 					echo get_lang('ExtraInformation');
 					echo '</div>';
 					echo '<div class="social-background-content">';
-						foreach($extra_user_data as $key=>$data) {
-							echo ucfirst($key).': '.$data;
-							echo '<br />';
+
+					foreach($extra_user_data as $key=>$data) {
+
+						// get display text, visibility and type from user_field table
+						$field_variable = str_replace('extra_','',$key);
+						$sql = "SELECT field_display_text,field_visible,field_type FROM $t_uf WHERE field_variable ='$field_variable'";
+						$res_field = Database::query($sql,__FILE__,__LINE__);
+						$row_field = Database::fetch_row($res_field);
+						$field_display_text = $row_field[0];
+						$field_visible = $row_field[1];
+						$field_type = $row_field[2];												
+						
+						if ($field_visible == 1) {
+							if (is_array($data)) {																																
+								echo '<strong>'.ucfirst($field_display_text).':</strong> '.implode(',',$data).'<br />';								
+							} else {								
+								if ($field_type == 8) {							
+									$id_options = explode(';',$data);
+									$value_options = array();							
+									// get option display text from user_field_options table
+									foreach ($id_options as $id_option) {														
+										$sql = "SELECT option_display_text FROM $t_ufo WHERE id = '$id_option'";
+										$res_options = Database::query($sql,__FILE__,__LINE__);
+										$row_options = Database::fetch_row($res_options);
+										$value_options[] = $row_options[0];
+									}
+									echo '<strong>'.ucfirst($field_display_text).':</strong> '.implode(' ',$value_options).'<br />'; 							
+								}
+								else {
+									echo '<strong>'.ucfirst($field_display_text).':</strong> '.$data.'<br />';
+								}								
+							}
 						}
+					}
 					echo '</div>';			
 					echo '<br /><br />';
 				}