diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-07 16:24:21 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-07 16:24:21 +0000 |
commit | 0503488741f3f05f0b01f87e038884f95817af44 (patch) | |
tree | 0cc71cc0598c92c4741590a90ccfb04249351154 | |
parent | 5a3f379a5ac398e31befa7d747c5d105d87cd4a3 (diff) | |
download | elgg-0503488741f3f05f0b01f87e038884f95817af44.tar.gz elgg-0503488741f3f05f0b01f87e038884f95817af44.tar.bz2 |
Fixed displaying of custom profile fields on profile page.
git-svn-id: http://code.elgg.org/elgg/trunk@5655 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/profile/start.php | 29 |
1 files changed, 14 insertions, 15 deletions
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; |