Support Forum ยป User Profile

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: โœ…Allow non-Admin roles access to settings page #12537
    tomtom
    Participant

    It works, thank you!

    in reply to: โœ…Allow non-Admin roles access to settings page #12523
    tomtom
    Participant

    Disregard the => formatting, of course.

    in reply to: โœ…Allow non-Admin roles access to settings page #12522
    tomtom
    Participant

    For example, the default generated will show up for admins but not for non-admins.

    add_filter( 'mb_settings_pages', 'prefix_options_page' );
    function prefix_options_page( $settings_pages ) {
    
            $settings_pages[] = array(
                'id'          => 'customize',
                'option_name' => 'customize',
                'menu_title'  => 'customize',
                'icon_url'    => 'dashicons-admin-generic',
                'style'       => 'boxes',
                'columns'     => 1,
    
                'position'    => 168,
            );
    
            return $settings_pages;
    }

    I tried wrapping it like so, but still a no-show for non-admins:

    add_filter( 'mb_settings_pages', 'prefix_options_page' );
    function prefix_options_page( $settings_pages ) {
    
            $settings_pages[] = array(
                'id'          => 'customize',
                'option_name' => 'customize',
                'menu_title'  => 'customize',
                'icon_url'    => 'dashicons-admin-generic',
                'style'       => 'boxes',
                'columns'     => 1,
    
                'position'    => 168,
            );
    
    if( current_user_can('editor') || current_user_can('administrator') ) {
                return $settings_pages;
    }
    }
Viewing 3 posts - 1 through 3 (of 3 total)