From 91cddbc4547cbb7888768f1752b63e7c860d35b0 Mon Sep 17 00:00:00 2001 From: ikawhero Date: Mon, 8 Oct 2007 08:10:45 +0000 Subject: [PATCH] Only include data from field types that are "small" --- user/profile/field/textarea/field.class.php | 6 ++++++ user/profile/lib.php | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/user/profile/field/textarea/field.class.php b/user/profile/field/textarea/field.class.php index 11d3925457..956c092cbe 100644 --- a/user/profile/field/textarea/field.class.php +++ b/user/profile/field/textarea/field.class.php @@ -11,6 +11,12 @@ class profile_field_textarea extends profile_field_base { $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; + } + } ?> diff --git a/user/profile/lib.php b/user/profile/lib.php index eade89bd9a..9a632c4805 100644 --- a/user/profile/lib.php +++ b/user/profile/lib.php @@ -162,6 +162,16 @@ class profile_field_base { } } + /** + * 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 *****/ @@ -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; } } -- 2.39.5