MyBB Community Forums

Full Version: Editor option
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi! The board I help admin recently switched to MyBB in the wake of the ZB dumpster fire, and I am trying to set up things to make the transition easier for our users. The first thing I haven't been able to figure out yet is this.

In the individual account profile settings, there is an option to check off to "Put the editor in source mode by default." Is there a way to set all accounts to that as the default? Only a few people have posted so far, and things they copy/pasted from the old boards have different text sizes/formatting and it's a little discombobulating. If that was enabled by default rather than the WYSIWYG option that would be a lot easier, as it wouldn't copy over formatting.
To enable it for all registered users in the future, run the following query:

ALTER TABLE `mybb_users` ALTER `sourceeditor` TINYINT(1) NOT NULL DEFAULT 1;

For all existing users, run the following query:

UPDATE `mybb_users` SET `sourceeditor` = 1 WHERE `sourceeditor` = 0;

Note that the queries assume your table prefix is mybb_. This may need to be changed.
Thanks for the quick reply... this is my first time as an admin in MyBB, can you tell me where in the ACP I would go to run those?
In that case, best of luck with your forum. See here on how to run SQL queries.
Excellent, thank you! Big Grin
Sorry to bump an old thread, figured it was better than making a new one for the same question.

I finally got my own forum for my database and I tried to run the query suggested above as written. I got this error:

Quote:SQL query:

ALTER TABLE mybb_users ALTER sourceeditor TINYINT(1) NOT NULL DEFAULT 1

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TINYINT(1) NOT NULL DEFAULT 1' at line 1

How do I correct this?

Thanks.
Please try this:
ALTER TABLE mybb_users MODIFY COLUMN sourceeditor tinyint(1) NOT NULL default '1';
Is that the one to change current or set it for all new members? I'd need both.

EDIT: Nevermind, I tried the second one above and it worked, as did the edited version. Thank you!
A simpler way to go about this is to put the editor in source mode by default via TEMPLATES.

You will need to navigate to your current in use templates for your specific skin (or do this with all templates, though I don't ever suggest touching the default MyBB one). From there go to the bottom Ungrouped Templates —> codebuttons, find this:
	MyBBEditor = $("#{$bind}").sceditor("instance");
	{$sourcemode}
and replace with this:
	MyBBEditor = $("#{$bind}").sceditor("instance");
	// {$sourcemode}
	MyBBEditor.sourceMode(true);

It will automatically use source mode no matter the users settings so no having to update.
(2023-01-22, 08:24 PM)Taylor M Wrote: [ -> ]A simpler way to go about this is to put the editor in source mode by default via TEMPLATES.

You will need to navigate to your current in use templates for your specific skin (or do this with all templates, though I don't ever suggest touching the default MyBB one). From there go to the bottom Ungrouped Templates —> codebuttons, find this:
	MyBBEditor = $("#{$bind}").sceditor("instance");
	{$sourcemode}
and replace with this:
	MyBBEditor = $("#{$bind}").sceditor("instance");
	// {$sourcemode}
	MyBBEditor.sourceMode(true);

It will automatically use source mode no matter the users settings so no having to update.

Perfect! Thank you for this. Saving for future reference.