WordPress.org

Ready to get started?Download WordPress

Forums

adminimize small bug / with my fix for wordpress MU (4 posts)

  1. sboisvert
    Member
    Posted 3 years ago #

    in the function _mw_adminimize_set_menu_option()

    I've replaced

    // set admin-menu
    foreach ($user_roles as $role) {

    if($role == $role[0]){
    if ( current_user_can($role) ) {
    $mw_adminimize_menu = $disabled_menu_[$role];
    $mw_adminimize_submenu = $disabled_submenu_[$role];
    }
    } elseif ( current_user_can($role) ) {
    $mw_adminimize_menu = $disabled_menu_[$role];
    $mw_adminimize_submenu = $disabled_submenu_[$role];
    }
    }

    by

    // set admin-menu
    foreach ($user_roles as $role) {
    $user = wp_get_current_user();
    if(in_array($role,$user->roles)){
    if ( current_user_can($role) ) {
    $mw_adminimize_menu = $disabled_menu_[$role];
    $mw_adminimize_submenu = $disabled_submenu_[$role];
    }
    }
    }

    As you can see my version checks if the current user has that role assigned to them before assigning it. The old code would always return true for Current user can when logged in as a site admin, therefore random permissions would be applied based on the order of the array.

    thank you for the great plugin

    http://wordpress.org/extend/plugins/adminimize/

  2. AntaresMHD
    Member
    Posted 3 years ago #

    Greetings!
    It's almost as if you were reading my mind- yesterday I left a message in the author's official site to report this problem with WordPress MU.

    I'm glad you posted this solution, it works nicely. However, there's still problems with the rest of the sections, for instance, the Write Post template. If I deactivate an option for the Authors (for instance), the Admin account(s) are affected as well. Not sure why is this happening and I can't quite see how to edit the plugin to fix this, specially considering it's related to WordPress MU and not the regular WordPress distribution. Any help would be appreciated.

  3. bengo-matus
    Member
    Posted 3 years ago #

    Yes, it's super. Autor: can, you fix it ?

  4. Frank
    Member
    Posted 3 years ago #

    Many thanks for this entry, i will include this on the next fix. Current i will write an new verison, all new code only for the important tasks of the plugin; is is to heavy and have so muc different options for different wp-version. I think i write at first a fix and afterthis a new verison.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags