Friday, October 15, 2010

How to enable theme and plugin editor for wordpress mu

After you install and login for first time in wordpress mu you will be astonished that under Appearance tab there is no longer present an "Editor" link and under under Plugins section there is no longer present "Plugin Editor" on Dashboard in WPMU. So you might wonder how you will change a theme or plugin or a stylesheet file from wordpress.


Following is a screenshot about how you see Appearance section.

You can get the editor by installing plugin or manually changing files in wordpress.

Installing Enable Theme and Plugin Editor (WPMU) plugin
You can get theme and plugin editor by simply,
- Login to Wordpress dashboard as site administrator.
- Under Plugins tab click on Add New.
- Install Plugin window will appear. You will see Search for plugins by keyword, author or tag.
- Choose Term from drop down menu, in the textbox type "Enable Theme and Plugin Editor" and then search Plugin. You will see "Enable Theme and Plugin Editor (WPMU)" there. Just install it and activate the plugin. You will see your editor for theme and plugin will appear in wordpress MU.

Manually Installing Enable Theme and Plugin Editor (WPMU) plugin

- Download the "Enable Theme and Plugin Editor (WPMU)" plugin from http://wordpress.org/extend/plugins/enable-theme-and-plugin-editor/.

- Using an FTP editor upload the plugin file(s) or folder to the /wp-content/plugins folder.
- Login to Wordpress dashboard as site administrator and click on Plugins.
- You should see your new Plugin listed. To turn the Plugin on, click Activate on the far right side of the list.
- After you activate you will see theme and plugin editors are enabled and you can modify files within wordpress admin panel.

Manually changing Wordpress files
- Go to wp-admin/includes folder of your Wordpress MU installation directory.
- You have to edit the mu.php file. Open the mu.php file with any editor software and search for the term "unset( $submenu['themes.php'][10]"); " and "unset( $submenu['themes.php'][10] );" . You have to comment both of these two lines.

So, before changes
unset( $submenu['plugins.php'][15] ); // always remove the plugin editor unset( $submenu['themes.php'][10] );  // always remove the themes editor 
And After Changes
/* unset( $submenu['plugins.php'][15] ); */ // always remove the plugin editor /* unset( $submenu['themes.php'][10] ); */ // always remove the themes editor 

- After you commented above two lines, you should be able to see the theme editor and plugin editor option but still those pages will not accessible. To overcome that, you need to make below changes in mu.php file.

Search for the term "if ( strpos( $_SERVER['PHP_SELF'], 'user-new.php'" inside mu.php file you will see following Before Changes lines. Then you need to make it like After Changes.

Before Changes
$pages = array( 'theme-editor.php', 'plugin-editor.php' ); foreach( $pages as $page ) {     if ( strpos( $_SERVER['PHP_SELF'], $page ) ) {         wp_die( __('Page disabled by the administrator') ); 
After Changes
$pages = array( 'theme-editor.php', 'plugin-editor.php' );   foreach( $pages as $page ) {      if ( strpos( $_SERVER['PHP_SELF'], $page )&& !is_site_admin() ) {          wp_die( __('Page disabled by the administrator') ); 
Now check on your Wordpress MU dashboard. You will find the theme editor and plugin editor is working properly in your MU installation.

No comments:

Post a Comment