From 0503488741f3f05f0b01f87e038884f95817af44 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 7 Apr 2010 16:24:21 +0000 Subject: Fixed displaying of custom profile fields on profile page. git-svn-id: http://code.elgg.org/elgg/trunk@5655 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/profile/start.php | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'mod/profile/start.php') diff --git a/mod/profile/start.php b/mod/profile/start.php index 4481b012b..9d5bb2e49 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -76,22 +76,21 @@ function profile_fields_setup() { 'twitter' => 'text' ); - // TODO: Have an admin interface for this - $n = 0; - $loaded_defaults = array(); - while ($translation = get_plugin_setting("admin_defined_profile_$n", 'profile')){ - // Add a translation - add_translation(get_current_language(), array("profile:admin_defined_profile_$n" => $translation)); - - // Detect type - $type = get_plugin_setting("admin_defined_profile_type_$n", 'profile'); - if (!$type) $type = 'text'; - - // Set array - $loaded_defaults["admin_defined_profile_$n"] = $type; - - $n++; + $loaded_default = array(); + if ($fieldlist = get_plugin_setting('user_defined_fields','profile')) { + if (!empty($fieldlist)) { + $fieldlistarray = explode(',',$fieldlist); + $loaded_defaults = array(); + foreach($fieldlistarray as $listitem) { + if ($translation = get_plugin_setting("admin_defined_profile_{$listitem}", 'profile')) { + $type = get_plugin_setting("admin_defined_profile_type_{$listitem}", 'profile'); + $loaded_defaults["admin_defined_profile_{$listitem}"] = $type; + add_translation(get_current_language(), array("profile:admin_defined_profile_{$listitem}" => $translation)); + } + } + } } + if (count($loaded_defaults)) { $CONFIG->profile_using_custom = true; $profile_defaults = $loaded_defaults; -- cgit v1.2.3