]> git.mjollnir.org Git - moodle.git/commitdiff
Changes merged from 1.8
authorikawhero <ikawhero>
Wed, 18 Apr 2007 02:10:15 +0000 (02:10 +0000)
committerikawhero <ikawhero>
Wed, 18 Apr 2007 02:10:15 +0000 (02:10 +0000)
Fix for MDL-9415
New method is_empty() added.

user/profile/lib.php

index 6b9a19acc3639e5b8f2abed5ce9b2e5736838991..bb0062776a5aa0396870e4727909d1f27bae6859 100644 (file)
@@ -223,6 +223,14 @@ class profile_field_base {
         }
     }
 
+    /**
+     * Check if the field data is considered empty
+     * return boolean
+     */
+    function is_empty() {
+        return ( ($this->data != '0') and empty($this->data));
+    }
+
     /**
      * Check if the field is required on the edit profile page
      * @return   boolean
@@ -332,7 +340,7 @@ function profile_display_fields($userid) {
                     require_once($CFG->dirroot.'/user/profile/field/'.$field->datatype.'/field.class.php');
                     $newfield = 'profile_field_'.$field->datatype;
                     $formfield = new $newfield($field->id, $userid);
-                    if ($formfield->is_visible() and ($formfield->data !== NULL)) {
+                    if ($formfield->is_visible() and !$formfield->is_empty()) {
                         print_row(s($formfield->field->name.':'), $formfield->display_data());
                     }
                 }