Skip to content

Commit

Permalink
Changes merged from 1.8
Browse files Browse the repository at this point in the history
Fix for MDL-9415
New method is_empty() added.
  • Loading branch information
ikawhero committed Apr 18, 2007
1 parent 1659a99 commit 4a7030e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion user/profile/lib.php
Expand Up @@ -223,6 +223,14 @@ function is_visible() {
}
}

/**
* 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
Expand Down Expand Up @@ -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());
}
}
Expand Down

0 comments on commit 4a7030e

Please sign in to comment.