From 1aeaf278c1269faa6ae7f6f69a5255c60f556096 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 26 Sep 2024 22:38:15 +0800 Subject: [PATCH] MDL-83282 core: Remove most reference to Atto Some references can remain, and others should remain until we drop support for YUI, or Atto is no longer supported in the plugins database. Note: Some reference to Atto will remain until such a time as it is no longer possible to support the editor via the plugins database. --- .../tests/external/set_plugin_order_test.php | 20 ++++++++ h5p/classes/helper.php | 5 -- h5p/tests/behat/h5p_overview.feature | 11 ----- lang/en/deprecated.txt | 2 + lang/en/h5p.php | 6 ++- lib/antivirus/clamav/db/upgrade.php | 2 +- lib/behat/classes/behat_context_helper.php | 2 +- lib/behat/classes/behat_session_trait.php | 2 +- lib/behat/classes/util.php | 3 -- lib/classes/plugininfo/editor.php | 7 ++- lib/db/install.php | 2 +- lib/editor/tests/privacy/provider_test.php | 20 ++------ .../tiny/plugins/recordrtc/db/upgrade.php | 2 +- lib/editorlib.php | 4 +- lib/tests/accesslib_test.php | 8 ++-- lib/tests/behat/behat_general.php | 2 +- lib/tests/plugininfo/editor_test.php | 35 +++++--------- lib/tests/weblib_test.php | 2 +- user/tests/externallib_test.php | 48 ++++++++++--------- 19 files changed, 87 insertions(+), 96 deletions(-) diff --git a/admin/tests/external/set_plugin_order_test.php b/admin/tests/external/set_plugin_order_test.php index e0cba9901b9..d05886c5617 100644 --- a/admin/tests/external/set_plugin_order_test.php +++ b/admin/tests/external/set_plugin_order_test.php @@ -129,6 +129,26 @@ final class set_plugin_order_test extends \externallib_advanced_testcase { ]; } + /** + * Test re-ordering plugins where one plugin is not enabled. + * + * Media plugins are ordered by rank, with enabled plugins first. + * This is similar to the editors test but covers a scenario that cannot be covered by the editors test due to + * not having enough plugins. + */ + public function test_execute_media_including_disabled(): void { + global $CFG; + + $this->resetAfterTest(); + $this->setAdminUser(); + + $CFG->media_plugins_sortorder = 'videojs,vimeo,html5video'; + + set_plugin_order::execute('youtube', -1); + + $this->assertSame('videojs,vimeo,html5video', $CFG->media_plugins_sortorder); + } + /** * Text execute method for plugins which do not support ordering. * diff --git a/h5p/classes/helper.php b/h5p/classes/helper.php index 56fc62280f4..89871e3e2b1 100644 --- a/h5p/classes/helper.php +++ b/h5p/classes/helper.php @@ -261,11 +261,6 @@ class helper { $tools = array(); // Getting information from available H5P tools one by one because their enabled/disabled options are totally different. - // Check the atto button status. - $link = \editor_atto\plugininfo\atto::get_manage_url(); - $status = strpos(get_config('editor_atto', 'toolbar'), 'h5p') > -1; - $tools[] = self::convert_info_into_array('atto_h5p', $link, $status); - // Check the Display H5P filter status. $link = \core\plugininfo\filter::get_manage_url(); $status = filter_get_active_state('displayh5p', context_system::instance()->id); diff --git a/h5p/tests/behat/h5p_overview.feature b/h5p/tests/behat/h5p_overview.feature index 90abd4a7d64..300234d4074 100644 --- a/h5p/tests/behat/h5p_overview.feature +++ b/h5p/tests/behat/h5p_overview.feature @@ -21,14 +21,3 @@ Feature: Check H5P tools information is correct And I click on "Save changes" "button" And I navigate to "H5P > H5P overview" in site administration And I should see "Disable" in the "H5P scheduled task" "table_row" - - @javascript - Scenario: H5P editor button. - Given I log in as "admin" - When I navigate to "H5P > H5P overview" in site administration - Then I should see "Enable" in the "Insert H5P button" "table_row" - And I click on "Insert H5P button" "link" - And I set the field "Toolbar config" to "style1 = title, bold, italic" - And I click on "Save changes" "button" - When I navigate to "H5P > H5P overview" in site administration - Then I should see "Disable" in the "Insert H5P button" "table_row" diff --git a/lang/en/deprecated.txt b/lang/en/deprecated.txt index f8f3fa43603..66535bb0834 100644 --- a/lang/en/deprecated.txt +++ b/lang/en/deprecated.txt @@ -163,3 +163,5 @@ imagecaption_help,core_badges issuername_help,core_badges language_help,core_badges version_help,core_badges +atto_h5p,core_h5p +atto_h5p_description,core_h5p diff --git a/lang/en/h5p.php b/lang/en/h5p.php index 4b9663b66fa..813f7044714 100644 --- a/lang/en/h5p.php +++ b/lang/en/h5p.php @@ -39,8 +39,6 @@ $string['address'] = 'Address'; $string['age'] = 'Typical age'; $string['ageDescription'] = 'The target audience of this content. Possible input formats separated by commas: "1,34-45,-50,59-".'; $string['altText'] = 'Alt text'; -$string['atto_h5p'] = 'Insert H5P button'; -$string['atto_h5p_description'] = 'The Insert H5P button in the Atto editor enables users to insert H5P content by either entering a URL or embed code, or by uploading an H5P file.'; $string['author'] = 'Author'; $string['authorcomments'] = 'Author comments'; $string['authorcommentsdescription'] = 'Comments for the editor of the content. (This text will not be published as a part of the copyright info.)'; @@ -302,3 +300,7 @@ $string['years'] = 'Year(s)'; $string['yearsfrom'] = 'Years (from)'; $string['yearsto'] = 'Years (to)'; $string['zip'] = 'Zip'; + +// Deprecated since Moodle 5.0. +$string['atto_h5p'] = 'Insert H5P button'; +$string['atto_h5p_description'] = 'The Insert H5P button in the Atto editor enables users to insert H5P content by either entering a URL or embed code, or by uploading an H5P file.'; diff --git a/lib/antivirus/clamav/db/upgrade.php b/lib/antivirus/clamav/db/upgrade.php index b09ea2348b7..d81858ff6a8 100644 --- a/lib/antivirus/clamav/db/upgrade.php +++ b/lib/antivirus/clamav/db/upgrade.php @@ -25,7 +25,7 @@ /** * Run all ClamAV plugin upgrade steps between the current DB version and the current version on disk. * - * @param int $oldversion The old version of atto in the DB. + * @param int $oldversion The old version of the plugin in the DB. * @return bool */ function xmldb_antivirus_clamav_upgrade($oldversion) { diff --git a/lib/behat/classes/behat_context_helper.php b/lib/behat/classes/behat_context_helper.php index 19e03c2e3bb..260dff7107f 100644 --- a/lib/behat/classes/behat_context_helper.php +++ b/lib/behat/classes/behat_context_helper.php @@ -112,7 +112,7 @@ class behat_context_helper { * This method will return all contexts which match the specified prefix. * * For example, to find all editors, you would pass in 'behat_editor', and this might return: - * - behat_editor_atto + * - behat_editor_tiny * - behat_editor_textarea * * @param string $prefix The prefix to search for diff --git a/lib/behat/classes/behat_session_trait.php b/lib/behat/classes/behat_session_trait.php index 9374443c0e7..9e8f8f01cba 100644 --- a/lib/behat/classes/behat_session_trait.php +++ b/lib/behat/classes/behat_session_trait.php @@ -1678,7 +1678,7 @@ EOF; * // Note: phpDoc beforeStep attribution not shown. * public function before_step(StepScope $scope) { * $callback = function (string $tag): bool { - * return $tag === 'editor_atto' || substr($tag, 0, 5) === 'atto_'; + * return $tag === 'editor_tiny' || substr($tag, 0, 5) === 'tiny_'; * }; * * if (!self::scope_tags_match($scope, $callback)) { diff --git a/lib/behat/classes/util.php b/lib/behat/classes/util.php index 2ea60f255d9..f6e233d089c 100644 --- a/lib/behat/classes/util.php +++ b/lib/behat/classes/util.php @@ -119,9 +119,6 @@ class behat_util extends testing_util { // Enable web cron. set_config('cronclionly', 0); - // Set editor autosave to high value, so as to avoid unwanted ajax. - set_config('autosavefrequency', '604800', 'editor_atto'); - // Set noreplyaddress to an example domain, as it should be valid email address and test site can be a localhost. set_config('noreplyaddress', 'noreply@example.com'); diff --git a/lib/classes/plugininfo/editor.php b/lib/classes/plugininfo/editor.php index 8c1ea707ebe..5e8d128dd9e 100644 --- a/lib/classes/plugininfo/editor.php +++ b/lib/classes/plugininfo/editor.php @@ -41,10 +41,13 @@ class editor extends base { global $CFG; if (empty($CFG->texteditors)) { - return array('atto'=>'atto', 'tinymce'=>'tinymce', 'textarea'=>'textarea'); + return [ + 'tiny' => 'tiny', + 'textarea' => 'textarea', + ]; } - $enabled = array(); + $enabled = []; foreach (explode(',', $CFG->texteditors) as $editor) { $enabled[$editor] = $editor; } diff --git a/lib/db/install.php b/lib/db/install.php index 89f532fd5f1..76acdbea0df 100644 --- a/lib/db/install.php +++ b/lib/db/install.php @@ -129,7 +129,7 @@ function xmldb_main_install() { 'sessiontimeout' => 8 * 60 * 60, // Must be present during roles installation. 'stringfilters' => '', // These two are managed in a strange way by the filters. 'filterall' => 0, // setting page, so have to be initialised here. - 'texteditors' => 'tiny,atto,tinymce,textarea', + 'texteditors' => 'tiny,textarea', 'antiviruses' => '', 'media_plugins_sortorder' => 'videojs,youtube', 'upgrade_extracreditweightsstepignored' => 1, // New installs should not run this upgrade step. diff --git a/lib/editor/tests/privacy/provider_test.php b/lib/editor/tests/privacy/provider_test.php index 5c01ca5263b..84a3ea4ea82 100644 --- a/lib/editor/tests/privacy/provider_test.php +++ b/lib/editor/tests/privacy/provider_test.php @@ -14,30 +14,20 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Privacy provider tests. - * - * @package core_editor - * @copyright 2018 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ namespace core_editor\privacy; -use core_privacy\local\metadata\collection; use core_privacy\local\request\writer; use core_editor\privacy\provider; -defined('MOODLE_INTERNAL') || die(); - /** * Privacy provider tests class. * * @package core_editor * @copyright 2018 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \core_editor\privacy\provider */ final class provider_test extends \core_privacy\tests\provider_testcase { - /** * When no preference exists, there should be no export. */ @@ -77,14 +67,14 @@ final class provider_test extends \core_privacy\tests\provider_testcase { /** * When an editor is set, the name of that editor will be reported. */ - public function test_editor_atto(): void { + public function test_editor_tiny(): void { $this->resetAfterTest(); // Create test user, add some preferences. $user = $this->getDataGenerator()->create_user(); $this->setUser($user); - set_user_preference('htmleditor', 'atto'); + set_user_preference('htmleditor', 'tiny'); // Switch to admin user (so we can validate preferences of the correct user are being exported). $this->setAdminUser(); @@ -99,13 +89,13 @@ final class provider_test extends \core_privacy\tests\provider_testcase { $this->assertNotEmpty($prefs->htmleditor); $this->assertNotEmpty($prefs->htmleditor->value); $this->assertNotEmpty($prefs->htmleditor->description); - $this->assertEquals('atto', $prefs->htmleditor->value); + $this->assertEquals('tiny', $prefs->htmleditor->value); $this->assertEquals( get_string( 'privacy:preference:htmleditor', 'core_editor', - get_string('pluginname', "editor_atto") + get_string('pluginname', "editor_tiny") ), $prefs->htmleditor->description ); diff --git a/lib/editor/tiny/plugins/recordrtc/db/upgrade.php b/lib/editor/tiny/plugins/recordrtc/db/upgrade.php index cf7eee6b88f..e4fc37d691e 100644 --- a/lib/editor/tiny/plugins/recordrtc/db/upgrade.php +++ b/lib/editor/tiny/plugins/recordrtc/db/upgrade.php @@ -24,7 +24,7 @@ /** * Run all Tiny recordrtc upgrade steps between the current DB version and the current version on disk. - * @param int $oldversion The old version of atto equation in the DB. + * @param int $oldversion The old version of the plugin in the DB. * @return bool */ function xmldb_tiny_recordrtc_upgrade($oldversion) { diff --git a/lib/editorlib.php b/lib/editorlib.php index a7ddebfd637..6a0b6d79cd3 100644 --- a/lib/editorlib.php +++ b/lib/editorlib.php @@ -95,7 +95,7 @@ function editors_get_enabled() { global $CFG; if (empty($CFG->texteditors)) { - $CFG->texteditors = 'atto,tiny,textarea'; + $CFG->texteditors = 'tiny,textarea'; } $active = array(); foreach(explode(',', $CFG->texteditors) as $e) { @@ -153,7 +153,7 @@ function editors_head_setup() { global $CFG; if (empty($CFG->texteditors)) { - $CFG->texteditors = 'atto,tiny,textarea'; + $CFG->texteditors = 'tiny,textarea'; } $active = explode(',', $CFG->texteditors); diff --git a/lib/tests/accesslib_test.php b/lib/tests/accesslib_test.php index da7adb76f22..e8b266eefba 100644 --- a/lib/tests/accesslib_test.php +++ b/lib/tests/accesslib_test.php @@ -4108,7 +4108,7 @@ final class accesslib_test extends advanced_testcase { // Just test a few representative capabilities. $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames', - 'repository/upload:view', 'atto/recordrtc:recordaudio']; + 'repository/upload:view', 'tiny/recordrtc:recordaudio']; $this->assert_capability_list_contains($expectedcapabilities, $actual); } @@ -4127,7 +4127,7 @@ final class accesslib_test extends advanced_testcase { // Just test a few representative capabilities. $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames', - 'repository/upload:view', 'atto/recordrtc:recordaudio']; + 'repository/upload:view', 'tiny/recordrtc:recordaudio']; $this->assert_capability_list_contains($expectedcapabilities, $actual); } @@ -4147,7 +4147,7 @@ final class accesslib_test extends advanced_testcase { // Just test a few representative capabilities. $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames', - 'repository/upload:view', 'atto/recordrtc:recordaudio']; + 'repository/upload:view', 'tiny/recordrtc:recordaudio']; $this->assert_capability_list_contains($expectedcapabilities, $actual); } @@ -4168,7 +4168,7 @@ final class accesslib_test extends advanced_testcase { // Just test a few representative capabilities. $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames', - 'repository/upload:view', 'atto/recordrtc:recordaudio']; + 'repository/upload:view', 'tiny/recordrtc:recordaudio']; $this->assert_capability_list_contains($expectedcapabilities, $actual); } diff --git a/lib/tests/behat/behat_general.php b/lib/tests/behat/behat_general.php index 94712c610e3..6334fcb5ada 100644 --- a/lib/tests/behat/behat_general.php +++ b/lib/tests/behat/behat_general.php @@ -2448,7 +2448,7 @@ EOF; } // Make the provided editor the default one in $CFG->texteditors by - // moving it to the first [editor],atto,tiny,textarea on the list. + // moving it to the first [editor],tiny,textarea on the list. $list = explode(',', $CFG->texteditors); array_unshift($list, $editor); $list = array_unique($list); diff --git a/lib/tests/plugininfo/editor_test.php b/lib/tests/plugininfo/editor_test.php index 1d644bbfc28..aefcbf84c00 100644 --- a/lib/tests/plugininfo/editor_test.php +++ b/lib/tests/plugininfo/editor_test.php @@ -167,14 +167,14 @@ final class editor_test extends advanced_testcase { * @param string $texteditors * @param string $pluginname * @param int $direction - * @param array $neworder + * @param array $expected * @param string $newtexteditors */ public function test_change_plugin_order( string $texteditors, string $pluginname, int $direction, - array $neworder, + array $expected, string $newtexteditors, ): void { global $CFG; @@ -184,7 +184,7 @@ final class editor_test extends advanced_testcase { editor::change_plugin_order($pluginname, $direction); $this->assertSame( - $neworder, + $expected, array_keys(editor::get_sorted_plugins()), ); $this->assertSame($newtexteditors, $CFG->texteditors); @@ -211,7 +211,7 @@ final class editor_test extends advanced_testcase { 'texteditors' => 'textarea,tiny', 'pluginname' => 'textarea', 'direction' => base::MOVE_DOWN, - 'neworder' => $getorder([ + 'expected' => $getorder([ 'tiny', 'textarea', ]), @@ -222,7 +222,7 @@ final class editor_test extends advanced_testcase { 'pluginname' => 'tiny', 'direction' => base::MOVE_DOWN, // Tiny is already at the bottom of the enabled plugins. - 'neworder' => $getorder([ + 'expected' => $getorder([ 'textarea', 'tiny', ]), @@ -232,8 +232,8 @@ final class editor_test extends advanced_testcase { 'texteditors' => 'textarea,tiny', 'pluginname' => 'atto', 'direction' => base::MOVE_DOWN, - // Atto is not enabled. No change expected. - 'neworder' => $getorder([ + // Atto is not available. No change expected. + 'expected' => $getorder([ 'textarea', 'tiny', ]), @@ -243,7 +243,7 @@ final class editor_test extends advanced_testcase { 'texteditors' => 'textarea,tiny', 'pluginname' => 'tiny', 'direction' => base::MOVE_UP, - 'neworder' => $getorder([ + 'expected' => $getorder([ 'tiny', 'textarea', ]), @@ -254,7 +254,7 @@ final class editor_test extends advanced_testcase { 'pluginname' => 'tiny', 'direction' => base::MOVE_UP, // Tiny is already at the top of the enabled plugins. - 'neworder' => $getorder([ + 'expected' => $getorder([ 'tiny', 'textarea', ]), @@ -264,19 +264,8 @@ final class editor_test extends advanced_testcase { 'texteditors' => 'textarea,tiny', 'pluginname' => 'atto', 'direction' => base::MOVE_UP, - // Atto is not enabled. No change expected. - 'neworder' => $getorder([ - 'textarea', - 'tiny', - ]), - 'newtexteditors' => 'textarea,tiny', - ], - [ - 'texteditors' => 'textarea,tiny', - 'pluginname' => 'atto', - 'direction' => base::MOVE_UP, - // Atto is not enabled. No change expected. - 'neworder' => $getorder([ + // Atto is not available. No change expected. + 'expected' => $getorder([ 'textarea', 'tiny', ]), @@ -287,7 +276,7 @@ final class editor_test extends advanced_testcase { 'pluginname' => 'fakeeditor', 'direction' => base::MOVE_UP, // The fakeeditor plugin does not exist. No change expected. - 'neworder' => $getorder([ + 'expected' => $getorder([ 'textarea', 'tiny', ]), diff --git a/lib/tests/weblib_test.php b/lib/tests/weblib_test.php index 6313e1750e4..e726249aa36 100644 --- a/lib/tests/weblib_test.php +++ b/lib/tests/weblib_test.php @@ -991,7 +991,7 @@ EXPECTED; $html = "

This is a test.

\"\"


Test content.

\"\"

"; + class=\"img-fluid \">

"; $draftareas = array( array( 'urlbase' => 'draftfile.php', diff --git a/user/tests/externallib_test.php b/user/tests/externallib_test.php index ba4ac134a70..0c4a61647ea 100644 --- a/user/tests/externallib_test.php +++ b/user/tests/externallib_test.php @@ -499,7 +499,7 @@ final class externallib_test extends externallib_advanced_testcase { $this->resetAfterTest(true); - $user1 = array( + $user1 = [ 'username' => 'usernametest1', 'password' => 'Moodle2012!', 'idnumber' => 'idnumbertest1', @@ -513,20 +513,22 @@ final class externallib_test extends externallib_advanced_testcase { 'description' => 'This is a description for user 1', 'city' => 'Perth', 'country' => 'AU', - 'preferences' => [[ + 'preferences' => [ + [ 'type' => 'htmleditor', - 'value' => 'atto' - ], [ + 'value' => 'tiny', + ], + [ 'type' => 'invalidpreference', - 'value' => 'abcd' - ] + 'value' => 'abcd', + ], ], 'department' => 'College of Science', 'institution' => 'National Institute of Physics', 'phone1' => '01 2345 6789', 'maildisplay' => 1, - 'interests' => 'badminton, basketball, cooking, ' - ); + 'interests' => 'badminton, basketball, cooking, ', + ]; // User with an authentication method done externally. $user2 = array( @@ -555,7 +557,7 @@ final class externallib_test extends externallib_advanced_testcase { if ($createduser['username'] === $user1['username']) { $usertotest = $user1; - $this->assertEquals('atto', get_user_preferences('htmleditor', null, $dbuser)); + $this->assertEquals('tiny', get_user_preferences('htmleditor', null, $dbuser)); $this->assertEquals(null, get_user_preferences('invalidpreference', null, $dbuser)); // Confirm user interests have been saved. $interests = \core_tag_tag::get_item_tags_array('core', 'user', $createduser['id'], @@ -810,7 +812,7 @@ final class externallib_test extends externallib_advanced_testcase { $user1 = self::getDataGenerator()->create_user(); - $user1 = array( + $user1 = [ 'id' => $user1->id, 'username' => 'usernametest1', 'password' => 'Moodle2012!', @@ -826,20 +828,22 @@ final class externallib_test extends externallib_advanced_testcase { 'city' => 'Perth', 'userpicture' => $draftid, 'country' => 'AU', - 'preferences' => [[ + 'preferences' => [ + [ 'type' => 'htmleditor', - 'value' => 'atto' - ], [ + 'value' => 'textarea', + ], + [ 'type' => 'invialidpreference', - 'value' => 'abcd' - ] + 'value' => 'abcd', + ], ], 'department' => 'College of Science', 'institution' => 'National Institute of Physics', 'phone1' => '01 2345 6789', 'maildisplay' => 1, - 'interests' => 'badminton, basketball, cooking, ' - ); + 'interests' => 'badminton, basketball, cooking, ', + ]; $context = \context_system::instance(); $roleid = $this->assignUserCapability('moodle/user:update', $context->id); @@ -892,7 +896,7 @@ final class externallib_test extends externallib_advanced_testcase { $this->assertEquals($dbuser->institution, $user1['institution']); $this->assertEquals($dbuser->phone1, $user1['phone1']); $this->assertEquals($dbuser->maildisplay, $user1['maildisplay']); - $this->assertEquals('atto', get_user_preferences('htmleditor', null, $dbuser)); + $this->assertEquals('textarea', get_user_preferences('htmleditor', null, $dbuser)); $this->assertEquals(null, get_user_preferences('invalidpreference', null, $dbuser)); // Confirm user interests have been saved. @@ -1385,7 +1389,7 @@ final class externallib_test extends externallib_advanced_testcase { $preferences = array( array( 'name' => 'htmleditor', - 'value' => 'atto', + 'value' => 'textarea', 'userid' => $user1->id, ), array( @@ -1401,7 +1405,7 @@ final class externallib_test extends externallib_advanced_testcase { $this->assertCount(2, $result['saved']); // Get preference from DB to avoid cache. - $this->assertEquals('atto', $DB->get_field('user_preferences', 'value', + $this->assertEquals('textarea', $DB->get_field('user_preferences', 'value', array('userid' => $user1->id, 'name' => 'htmleditor'))); $this->assertEquals('tiny', $DB->get_field('user_preferences', 'value', array('userid' => $user2->id, 'name' => 'htmleditor'))); @@ -1525,7 +1529,7 @@ final class externallib_test extends externallib_advanced_testcase { $preferences = array( array( 'name' => 'htmleditor', - 'value' => 'atto', + 'value' => 'textarea', 'userid' => $user->id, ) ); @@ -1536,7 +1540,7 @@ final class externallib_test extends externallib_advanced_testcase { $this->assertCount(1, $result['saved']); // Get preference from DB to avoid cache. - $this->assertEquals('atto', $DB->get_field('user_preferences', 'value', + $this->assertEquals('textarea', $DB->get_field('user_preferences', 'value', array('userid' => $user->id, 'name' => 'htmleditor'))); // Now, unset.