Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #287193

    Hello
    I am in a multisite environnement and would like to hide/desactivated the Avia configuration to Super Admins only.
    I try to do as I always do for other plugins : remove_menu_page('avia'); but it still there…
    Thank you

    #287216

    I have write the code below in the file: /enfold/framework/php/class-adminpages.php for the function attach_options_to_menu() and it works but don’t like to modify core Enfold file, do you have a better solution?`
    function attach_options_to_menu()
    {
    if(!isset($this->avia_superobject->option_pages)) return;

    // BEGIN : MODIFICATION
    if ( !is_super_admin() ) {
    $current_user = wp_get_current_user();
    if ( !($current_user instanceof WP_User) )
    return;
    $roles = $current_user->roles;
    if (in_array(‘administrator’,$roles)) {return;}
    }
    // END : MODIFICATION



    `

    #287297

    Much, much better:

    function remove_menus_avia(){
      remove_menu_page( 'avia' );
    }
    add_action( 'admin_menu', 'remove_menus_avia', 9999);

    > Closed :)

    #287299

    Hi!

    Glad you figured it out and thank you for sharing Pako69 :)

    Regards,
    Yigit

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘How to restrict Avia configuration to Super Admins’ is closed to new replies.