]> git.mjollnir.org Git - moodle.git/commitdiff
Only include data from field types that are "small"
authorikawhero <ikawhero>
Mon, 8 Oct 2007 08:10:45 +0000 (08:10 +0000)
committerikawhero <ikawhero>
Mon, 8 Oct 2007 08:10:45 +0000 (08:10 +0000)
user/profile/field/textarea/field.class.php
user/profile/lib.php

index 11d39254573f00bc5490221b812806d29e31dcaf..956c092cbe02a2c2c868cdc53ebb529cee095583 100644 (file)
@@ -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;
+    }
+
 }
 
 ?>
index eade89bd9a8abe8583e77602c43a5bc5484a2d25..9a632c48051a40c99394b9b7f9a77d5a474f79a0 100644 (file)
@@ -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;
         }
     }