Show WordPress Plugin Menu(Admin) To Editor

Check these links below. This is where the permissions are being set for your pretty link plugin admin menu:

pretty-link/prli-main.php -> line 16 it’s set to administrator you want edit_posts

pretty-link/prli-main.php -> line 160 it’s set to $current_user->user_level >= 8 you want $current_user->user_level >= 7


What are your options?

OPTION 1 – Change the code

  1. Go to this exact link (example should be your site name) and change administrator to edit_posts:

http://example.com/wp-admin/plugin-editor.php?file=pretty-link/prli-main.php&a=te&scrollto=265

  1. Go to this exact link and change if($current_user->user_level >= 8) to if($current_user->user_level >= 7)

http://example.com/wp-admin/plugin-editor.php?file=pretty-link/prli-main.php&a=te&scrollto=2933

  1. Save the changes.

OPTION 2 – Override the code

  1. Add this below to your functions.php to add the admin menus. If you want the dashboard widget as well and they don’t have access just do the following for the prli_add_dashboard_widgets function as well.

    remove_action('admin_menu', 'prli_menu');
    add_action('admin_menu', 'prli_menu_new', 99999);
    
    function prli_menu_new()
    {
      global $prli_options, $prlipro_options;
    
      $role="edit_posts";
      if(isset($prlipro_options->min_role))
        $role = $prlipro_options->min_role;
    
      $prli_menu_hook = add_menu_page( __('Pretty Link | Manage Pretty Links', 'pretty-link'), __('Pretty Link', 'pretty-link'), $role, 'pretty-link', 'PrliLinksController::route', PRLI_IMAGES_URL.'/pretty-link-small.png' );
      $prli_add_links_menu_hook = add_submenu_page( 'pretty-link', __('Pretty Link | Add New Link', 'pretty-link'), __('Add New Link', 'pretty-link'), $role, 'add-new-pretty-link', 'PrliLinksController::new_link' );
      add_submenu_page('pretty-link', 'Pretty Link | Groups', 'Groups', $role, PRLI_PATH.'/prli-groups.php');
    
      if( isset($prli_options->extended_tracking) and $prli_options->extended_tracking != "count" )
        add_submenu_page('pretty-link', 'Pretty Link | Hits', 'Hits', $role, PRLI_PATH.'/prli-clicks.php');
    
      add_submenu_page('pretty-link', 'Pretty Link | Tools', 'Tools', $role, PRLI_PATH.'/prli-tools.php');
      add_submenu_page('pretty-link', 'Pretty Link | Options', 'Options', $role, PRLI_PATH.'/prli-options.php');
    
      add_action('admin_head-pretty-link/prli-clicks.php', 'prli_reports_admin_header');
      add_action('admin_print_scripts-' . $prli_menu_hook, 'PrliLinksController::load_scripts');
      add_action('admin_print_scripts-' . $prli_add_links_menu_hook, 'PrliLinksController::load_scripts');
      add_action('admin_head-pretty-link/prli-groups.php', 'prli_groups_admin_header');
      add_action('admin_head-pretty-link/prli-options.php', 'prli_options_admin_header');
    
      add_action('admin_print_styles-' . $prli_menu_hook, 'PrliLinksController::load_styles');
      add_action('admin_print_styles-' . $prli_add_links_menu_hook, 'PrliLinksController::load_styles');
    
      add_action('admin_head-' . $prli_menu_hook, 'PrliLinksController::load_dynamic_scripts', 100);
    }
    

Option 3: You can also add these on an individual basis if you don’t need to give them access to everything. For example:

add_action( 'admin_menu', 'pretty_links_override_action_edit_posts_role', 99999 );

function pretty_links_override_action_edit_posts_role() {
           $role="edit_posts";
           // remove them first
           remove_menu_page( 'pretty-link');
           remove_submenu_page('pretty-link', 'add-new-pretty-link');

           add_menu_page( __('Pretty Link | Manage Pretty Links', 'pretty-link'), __('Pretty Link', 'pretty-link'), $role, 'pretty-link', 'PrliLinksController::route', PRLI_IMAGES_URL.'/pretty-link-small.png' );  
           add_submenu_page( 'pretty-link', __('Pretty Link | Add New Link', 'pretty-link'), __('Add New Link', 'pretty-link'), $role, 'add-new-pretty-link', 'PrliLinksController::new_link' );

}

Option 4: A plugin

Try installing admin menu editor or admin ui customize

Option 5: Premium

Pay for the premium version which has support for this

Option 6: Hack premium options

Hardcode $prlipro_options. While this makes the most sense to me, it’s probably not appropriate to add here, since I’d be screwing the plugin author.