Skip to content

Commit

Permalink
Only include data from field types that are "small"
Browse files Browse the repository at this point in the history
  • Loading branch information
ikawhero committed Oct 8, 2007
1 parent 4354a3e commit 91cddbc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions user/profile/field/textarea/field.class.php
Expand Up @@ -11,6 +11,12 @@ function edit_field_add(&$mform) {
$mform->setType($this->inputname, PARAM_CLEAN);
}

/// Overwrite base class method, data in this field type is potentially too large to be
/// included in the user object
function is_user_object_data() {
return false;
}

}

?>
12 changes: 11 additions & 1 deletion user/profile/lib.php
Expand Up @@ -162,6 +162,16 @@ function edit_load_user_data(&$user) {
}
}

/**
* Check if the field data should be loaded into the user object
* By default it is, but for field types where the data may be potentially
* large, the child class should override this and return false
* @return boolean
*/
function is_user_object_data() {
return true;
}


/***** The following methods generally should not be overwritten by child classes *****/

Expand Down Expand Up @@ -399,7 +409,7 @@ function profile_user_record($userid) {
require_once($CFG->dirroot.'/user/profile/field/'.$field->datatype.'/field.class.php');
$newfield = 'profile_field_'.$field->datatype;
$formfield = new $newfield($field->id, $userid);
$user->{$field->shortname} = $formfield->data;
if ($formfield->is_user_object_data()) $user->{$field->shortname} = $formfield->data;
}
}

Expand Down

0 comments on commit 91cddbc

Please sign in to comment.