$usercontext = context_user::instance($user->id); $editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'forcehttps' => false, 'context' => $usercontext); $user = file_prepare_standard_editor($user, 'description', $editoroptions, $usercontext, 'user', 'profile', 0); } else { $usercontext = null; // This is a new user, we don't want to add files here. $editoroptions = array('maxfiles' => 0, 'maxbytes' => 0, 'trusttext' => false, 'forcehttps' => false, 'context' => $coursecontext); } // Prepare filemanager draft area. $draftitemid = 0; $filemanagercontext = $editoroptions['context']; $filemanageroptions = array('maxbytes' => $CFG->maxbytes, 'subdirs' => 0, 'maxfiles' => 1, 'accepted_types' => 'web_image'); file_prepare_draft_area($draftitemid, $filemanagercontext->id, 'user', 'newicon', 0, $filemanageroptions); $user->imagefile = $draftitemid; // Create form. $userform = new user_editadvanced_form(new moodle_url($PAGE->url, array('returnto' => $returnto)), array('editoroptions' => $editoroptions, 'filemanageroptions' => $filemanageroptions, 'user' => $user)); if ($usernew = $userform->get_data()) { $usercreated = false; if (empty($usernew->auth)) { // User editing self. $authplugin = get_auth_plugin($user->auth); unset($usernew->auth); // Can not change/remove. } else { $authplugin = get_auth_plugin($usernew->auth); } $usernew->timemodified = time(); $createpassword = false; if ($usernew->id == -1) { unset($usernew->id); $createpassword = !empty($usernew->createpassword);
'context' => $coursecontext ); } // Prepare filemanager draft area. $draftitemid = 0; $filemanagercontext = $editoroptions['context']; $filemanageroptions = array('maxbytes' => $CFG->maxbytes, 'subdirs' => 0, 'maxfiles' => 1, 'accepted_types' => 'web_image'); file_prepare_draft_area($draftitemid, $filemanagercontext->id, 'user', 'newicon', 0, $filemanageroptions); $user->imagefile = $draftitemid; //create form $userform = new user_editadvanced_form(null, array( 'editoroptions' => $editoroptions, 'filemanageroptions' => $filemanageroptions, 'userid' => $user->id)); $userform->set_data($user); if ($usernew = $userform->get_data()) { if (empty($usernew->auth)) { //user editing self $authplugin = get_auth_plugin($user->auth); unset($usernew->auth); //can not change/remove } else { $authplugin = get_auth_plugin($usernew->auth); } $usernew->timemodified = time();
require_once($CFG->dirroot.'/tag/lib.php'); $user->interests = tag_get_tags_array('user', $id); } if ($user->id !== -1) { $usercontext = get_context_instance(CONTEXT_USER, $user->id); $editoroptions = array('maxfiles'=>EDITOR_UNLIMITED_FILES, 'maxbytes'=>$CFG->maxbytes, 'trusttext'=>false, 'forcehttps'=>false); $user = file_prepare_standard_editor($user, 'description', $editoroptions, $usercontext, 'user', 'profile', 0); } else { $usercontext = null; // This is a new user, we don't want to add files here $editoroptions = array('maxfiles'=>0, 'maxbytes'=>0, 'trusttext'=>false, 'forcehttps'=>false); } //create form $userform = new user_editadvanced_form(null, array('editoroptions'=>$editoroptions)); $userform->set_data($user); if ($usernew = $userform->get_data()) { add_to_log($course->id, 'user', 'update', "view.php?id=$user->id&course=$course->id", ''); if (empty($usernew->auth)) { //user editing self $authplugin = get_auth_plugin($user->auth); unset($usernew->auth); //can not change/remove } else { $authplugin = get_auth_plugin($usernew->auth); } $usernew->timemodified = time();