Plugin Directory

Changeset 1640871


Ignore:
Timestamp:
04/19/2017 08:08:30 PM (9 years ago)
Author:
GeekStreetWP
Message:

added support for multisite super admin and regular admin

Location:
plugins-admin-bar
Files:
86 added
2 edited

Legend:

Unmodified
Added
Removed
  • plugins-admin-bar/trunk/plugins-admin-bar.php

    r1639327 r1640871  
    22/**
    33 * Plugin Name: Plugins Admin Bar
    4  * Plugin URI: https://github.com/KrashKartMedia/plugins-admin-bar
     4 * Plugin URI: https://wordpress.org/plugins/plugins-admin-bar/
    55 * Description: Add a top level menu item to the admin bar for plugin links.
    6  * Version: 1.1
     6 * Version: 1.2
    77 * Author: Russell Aaron
    88 * Author URI: http://russellenvy.com
     
    1313    // hook into admin bar-menu - add our own links
    1414    add_action('admin_bar_menu', 'plugins_admin_bar_links', 999);
     15   
    1516    //kick off the function
    1617    function plugins_admin_bar_links($wp_admin_bar) {
    17         //is multisite
    18         if ( is_multisite() ) {
     18        $plugins_menu_perms = get_site_option( 'menu_items' );
     19        //is multisite && user can manage_network_plugins
     20        if ( is_multisite() && current_user_can('manage_network_options') ) {
    1921        //network parent link under site-name
    2022        $args = array(
     
    149151        );
    150152        $wp_admin_bar->add_node($args);
    151         }
    152         //is_single_site
    153         else {
    154             $args = array(
     153
     154        //is multisite && user can manage_network_plugins
     155        }
     156       
     157        //is_multisite && current user can manage options && plugins menu site option is true
     158        else if ( is_multisite() && current_user_can( 'manage_options' ) && isset($plugins_menu_perms['plugins'] ) ) {
     159        $args = array(
     160        'id' => 'network-single-admin-plugins',
     161        'title' => 'Plugins'. print_r($plugins_checked,1),
     162        'href' => admin_url() . 'plugins.php',
     163        'parent' => 'site-name',
     164        'meta' => array(
     165            'class' => 'network-single-admin-plugins',
     166            'title' => 'View Plugins'
     167            )
     168        );
     169        $wp_admin_bar->add_node($args);
     170
     171        //Add Active Plugin Child Link to installed-plugins - single site on MS parent link
     172        $args = array(
     173        'id' => 'network-single-admin-plugins-active',
     174        'title' => 'Active Plugins',
     175        'href' => admin_url() . 'plugins.php?plugin_status=active',
     176        'parent' => 'network-single-admin-plugins',
     177        'meta' => array(
     178            'class' => 'network-single-admin-plugins-',
     179            'title' => 'Active Plugins'
     180            )
     181        );
     182        $wp_admin_bar->add_node($args);
     183
     184        //Add Inactive Plugin Child Link to installed-plugins  - single site on MS parent link
     185        $args = array(
     186        'id' => 'network-single-admin-plugins-inactive',
     187        'title' => 'Inactive Plugins',
     188        'href' => admin_url() . 'plugins.php?plugin_status=inactive',
     189        'parent' => 'network-single-admin-plugins',
     190        'meta' => array(
     191            'class' => 'network-single-admin-plugins-inactive',
     192            'title' => 'Inactive Plugins'
     193            )
     194        );
     195        $wp_admin_bar->add_node($args);
     196
     197        //is_multisite && current user can manage options && plugins menu site option is true
     198        }
     199
     200        //is_single_site && user can manage_options
     201        else if ( ! is_multisite() && current_user_can('manage_options') ) {
     202        $args = array(
    155203        'id' => 'single-plugins',
    156204        'title' => 'Plugins',
     
    242290        $wp_admin_bar->add_node($args);
    243291
     292        //is_single_site && user can manage_options
    244293        }
    245     //stop plugins_admin_bar_links funciton
     294     //kick off the function
    246295    }
    247296?>
  • plugins-admin-bar/trunk/readme.txt

    r1639328 r1640871  
    11=== Plugins Admin Bar - WordPress Plugin Adding Plugin Link To WP Admin Bar Sub Menu ===
    2 Contributors: GeekStreetWP
     2Contributors: GeekStreetWP, binarygary
    33Author URI: https://wordpress.org/plugins/plugins-admin-bar/
    44Tags: plugin, plugins, admin, wp-admin-bar,
    55Requires at least: 4.1
    66Tested up to: 4.7.3
    7 Stable tag: 1.1
     7Stable tag: 1.2
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Plugins Admin Bar is a free WordPress Plugin that adds a link to the WordPress Admin Bar, under the site name menu.
     11Plugins Admin Bar is a free WordPress Plugin that adds quick links to the WordPress Admin Bar, under the site name menu, for plugins and network plugins on multisite.
    1212
    1313== Description ==
     
    1717WordPress has the WP Admin Bar at the top of every site. On the front end of the site, you'll see the name of your site as a link to /wp-admin/. Under the Site Name, there is a sub-menu with quick links to the Dashboard, Themes, Widgets, and Menus.
    1818
     19= What shows up when the plugin is installed on a single install of WordPress? =
    1920
    2021Plugin Admin Bar adds a new menu item to the quick links sub-menu, called Plugins, for a single site install.
     22
    2123The new menu item has it's own sub menu with quick links to Add a new plugin, add new popular plugin, add new recommended plugin, add new favorite plugin, view active plugins, and view inactive plugins.
    2224
    23 Plugin Admin Bar adds two new menu item to the quick links sub-menu, called Plugins and Network Plugins, for a multisite install. The two new menu items have their own sub menu items with quick links to Add a new network plugin, add new popular plugin, add new recommended plugin, add new favorite plugin, view network active plugins, and view network inactive plugins, and view network must use plugins. You can also view plugins active or inactive for a single site.
     25= What shows up when the plugin is installed on a multisite install of WordPress and I am a Super Admin? =
     26
     27Plugin Admin Bar adds two new menu item to the quick links sub-menu, called Plugins and Network Plugins, for a multisite install, as long as you are the Super Admin of the multisite network.
     28
     29The two new menu items have their own sub menu items with quick links to Add a new network plugin, add new popular plugin, add new recommended plugin, add new favorite plugin, view network active plugins, and view network inactive plugins, and view network must use plugins. You can also view plugins active or inactive for a single site.
     30
     31= What shows up when the plugin is installed on a multisite install of WordPress and I am an Admin? =
     32
     33If you are a single site admin, on multisite, you'll only see all plugins, active & inactive plugins in the dropdown menu item.
    2434
    2535See screenshots for more information.
     
    3141= Does this work with Multisite? =
    3242
    33 Yes. If you're on mutisite, add new plugin link takes you to the newtowrk admin install page. Same for the edit plugins.
     43Yes. If you're on multisite, add new plugin link takes you to the network admin install page. Same for the edit plugins.
     44
     45= Why doesnt the plugins menu item show for site admins of a subdomain/subfoler site? =
     46
     47There is an option in the Network Settings where a network admin (Super Admin) has to select the option to show the plugins menu in the left naviagtion bar for admins of a single Multisite site.
    3448
    3549== Installation ==
     
    6680== Changelog ==
    6781
     82= 1.2 =
     83* Added: Conditional Checks for Multisite vs. Single Site.
     84* Added: If muiltisite && current user can managae options, show the full network & plugins menus.
     85* Added If is not multisite && current user can manage options, show full plugins menu.
     86* Added: There is a setting in multisite where a network admin (Super Admin) must choose to show the plugins menu item for Multisite single site admins. If selected, a site admin will see the drop down displaying all plugins, active and inactive plugins just for the specific site.
     87* Fixed: Typo in the FAQ section on Readme.txt.
     88* Updated: FAQ section on Readme.txt file answers more questions.
     89
    6890= 1.1 =
    6991* Added: Support for multisite.
Note: See TracChangeset for help on using the changeset viewer.