The MU forums have moved to WordPress.org

How can I edit themes through the browser? (21 posts)

  1. onethousandseas
    Member
    Posted 14 years ago #

    I installed WPMU because I'm running a couple of blogs that only I am admin to so it's not a security risk. But is there a plugin or some way to edit themes through the browser in WPMU the same as in WP?

    Thanks.

  2. andrea_r
    Moderator
    Posted 14 years ago #

    If you're the only one:

    look in wp-admin/theme-editor.php. Near the top there's a line that says wp_die. remove it or comment it out (stick // at the first of this line).

    Then the theme editor is there, but not in the menus. I just type it in.

  3. onethousandseas
    Member
    Posted 14 years ago #

    Yes! Worked great, thank you :-)

  4. MelRidger
    Member
    Posted 14 years ago #

    I tried that and I got Cannot load /wp-admin/theme-editor.php.

    Is this what I'm supposed to do
    //if ( ! isset($themes[$theme]) )
    // wp_die(__('The requested theme does not exist.'));

  5. MelRidger
    Member
    Posted 14 years ago #

    Now I am getting a message that says disabled

    I also tried just putting the // next to the wp_die ... but got the same message

  6. dsader
    Member
    Posted 14 years ago #

    "Near the top" MelRidger,

    Turn this
    wp_die( 'Disabled' );

    into this
    // wp_die( 'Disabled' );

    Nothing else, nada.

  7. andrea_r
    Moderator
    Posted 14 years ago #

    Gonna be irrelevant in the next release. :)

  8. dsader
    Member
    Posted 14 years ago #

    "Gonna be irrelevant in the next release. :)"

    I found the new function/hook "disable_some_pages" in mu.php v2.8.1

    Looks prime for a "toggle forbidden pages" plugin, now.

  9. andrea_r
    Moderator
    Posted 14 years ago #

    Did you find where the wp_die was replaced by is_site_admin? :)

  10. MelRidger
    Member
    Posted 14 years ago #

    I changed it and I'm still getting disabled. Also everything in the admin page looks different today. The navigation gos all the way across.

  11. onethousandseas
    Member
    Posted 14 years ago #

    K :-) I just upgraded as well. So which line in which file should I be commenting out now?

  12. wp_bizkid
    Member
    Posted 14 years ago #

    The best way to enable theme editor is to comment out the following in the mu.php

    $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') );
    }
    }
    but be careful it opens the editor for all the users with admin powers
    -----
    Anybody professionally programmer of wp can suggest how to add the icon of theme editor, plugin editor to the admin menu.
    Presently i am typing the full link eg:
    http://www.myfundmachine.ws/wp-admin/plugin-editor.php or
    http://www.myfundmachine.ws/wp-admin/theme-editor.php

    Cheers
    Deep

  13. wp_bizkid
    Member
    Posted 14 years ago #

    If you dont wanna activate the plugin-editor please make a different page loop and add the plugin-editor in the disable section.

    Cheers
    Deep

  14. wp_bizkid
    Member
    Posted 14 years ago #

    WOW i find out how to add the link on the menu bar too.

    Just open mu.php and find function wpmu_menu()
    then add this following two lines. it will add the links to ur site admin option from there u can edit themes as well as plugins (be carefull while u edit plugins)

    $submenu[ 'wpmu-admin.php' ][35] = array( __('Themes Editor'), '10', 'theme-editor.php' );
    $submenu[ 'wpmu-admin.php' ][40] = array( __('Plugin Editor'), '10', 'plugin-editor.php' );

    Cheers
    Deep

  15. onethousandseas
    Member
    Posted 14 years ago #

    Awesome, found it in /wp-admin/includes/mu.php :-)

    Thanks Deep, tagging this resolved.

  16. aberean
    Member
    Posted 14 years ago #

    Thank you for this info!

  17. ericaakira
    Member
    Posted 14 years ago #

    No, no simple comment!
    It's a big risk!

    Go to mu.ph, and find:

    $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') );		}	}

    Replace for this:

    $pages = array( 'theme-editor.php', 'plugin-editor.php' );
    foreach( $pages as $page ) {
    //if ( strpos( $_SERVER['PHP_SELF'], $page ) ) {
    if ( strpos( $_SERVER['PHP_SELF'], $page ) && !is_site_admin() ) {
    wp_die( __('Page disabled by the administrator') );		}	}
  18. ericaakira
    Member
    Posted 14 years ago #

    with the code above, theme editor is active ONLY for MU admin.

    I have tested with a "simple" blog admin account. Theme and Plugin Editor is not available for this account.

    Cheers!

  19. paintgirl
    Member
    Posted 14 years ago #

    The code just above (ericaakira) worked PERFECT for the theme editor. Still have problem with plugin editor. When clicked says page does not exist (wp-admin/theme-editor.php). It certainly does exist so obviously there's a foul up somewhere. Any ideas?

  20. paintgirl
    Member
    Posted 14 years ago #

    Okay, I added a new plugin and activated it and now the plugin editor page seems to be functioning fine. I hate being a newbie!

  21. sastowe
    Member
    Posted 14 years ago #

    The only thing I get that is a little weird is now when I edit pages and posts it tries to show the background of the page in the edkiting window.

About this Topic

  • Started 14 years ago by onethousandseas
  • Latest reply from sastowe