CKEditor as default editor

Creating and modifying plugins.
Post Reply
arne johansson
Posts: 3
Joined: Wed Feb 18, 2015 9:15 am

CKEditor as default editor

Post by arne johansson »

Hello,
I'm using the plugin "user self-registration" and want the CKEditor to be the default editor. As it is now I have, as administrator, to change editor for every new user.

Is it possible to set the CKEditor as default, an if, how do I do that?

Best regards
Arne Johansson
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: CKEditor as default editor

Post by garvinhicking »

Hey,

currently the plugin doesn't offer an option to actually do that. But it's not so hard to patch out until we add the config option (it would make sense to set defaults for ALL available options, but that is some larger work).

To achieve it in your case, simply edit the common.inc.php file of the plugin and search for this line:

Code: Select all

                    serendipity_db_query("UPDATE {$serendipity['dbPrefix']}authors
                                             SET right_publish = '" . ($author['right_publish'] ? '1' : '0') . "',
                                                 password      = '" . $author['password'] . "'
                                           WHERE authorid = " . (int)$newID);
                    serendipity_set_config_var('no_create', $author['no_create'], $newID);
                    serendipity_set_config_var('lang', $serendipity['lang'], $newID);
now change that to:

Code: Select all

                    serendipity_db_query("UPDATE {$serendipity['dbPrefix']}authors
                                             SET right_publish = '" . ($author['right_publish'] ? '1' : '0') . "',
                                                 password      = '" . $author['password'] . "'
                                           WHERE authorid = " . (int)$newID);
                    serendipity_set_config_var('no_create', $author['no_create'], $newID);
                    serendipity_set_config_var('lang', $serendipity['lang'], $newID);
                    serendipity_set_config_var('wysiwyg', 1, $newID);
The last line is what's new, it simply sets the option called "wysiwyg" to 1 (yes) by default.

(This will only apply to new users, not existing ones)

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: CKEditor as default editor

Post by garvinhicking »

(I created a github issue https://github.com/s9y/Serendipity/issues/308 for this to remind me of adding such a feature in the future)
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: CKEditor as default editor

Post by garvinhicking »

Hey!

This has now been addressed in the new version of the plugin (2.38) that should apeart within the next 24 hours on Spartacus.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply