]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixed displaying of custom profile fields on profile page.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 7 Apr 2010 16:24:21 +0000 (16:24 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 7 Apr 2010 16:24:21 +0000 (16:24 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@5655 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/profile/start.php

index 4481b012b1a18ca89534fd6fd64c65fe3831f3ce..9d5bb2e49ae9621c4a305eaf5b326b55270c4bdb 100644 (file)
@@ -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;