How to set TinyMCE as default editor for current users

by Rob Gietema last modified Sep 28, 2009 07:33 AM
A brief description on how to set TinyMCE as default editor for all the current users.

Purpose

This howto will show you how you can set the default editor to TinyMCE for all current users.

Prerequisities

This howto assumes you have basic knowledge of Zope and writing Python scripts.

Step by step

To convert all the users you have to write a Python script. Because the script contains trusted code you can't simply add a python script in the ZMI but have to use for example an external method. The script looks as follows:

def Kupu2TinyMCE(self):
    pm = self.portal_membership
    for memberId in pm.listMemberIds():
       member = pm.getMemberById(memberId)
       editor = member.getProperty('wysiwyg_editor', None)
       if editor == 'TinyMCE':
           print('%s: TinyMCE already selected, leaving alone' % memberId)
       else:
           member.setMemberProperties({'wysiwyg_editor': 'TinyMCE'})
           print('%s: TinyMCE has been set' % memberId)
    return

Once the script is created you'll have to run it after which all users will have TinyMCE set as wysiwyg editor.

If you want to revert your actions and switch back to Kupu, you can simply change 'TinyMCE' to 'Kupu' and re-run the script.

Thanks to kcraig for providing the script.