Plugin Directory

Changeset 2591584


Ignore:
Timestamp:
08/31/2021 03:28:42 PM (5 years ago)
Author:
danielpw
Message:
  • Fixed bug that prevented a super admin of a multisite from adding themselves as a board member.
  • Tested up to WordPress 5.8.
Location:
nonprofit-board-management
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • nonprofit-board-management/assets/icon.svg

    r1261220 r2591584  
    1 <?xml version="1.0" encoding="utf-8"?>
    2 <!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
    3 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
    41<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    52     viewBox="0 0 256 256" enable-background="new 0 0 256 256" xml:space="preserve">
    6 <circle fill="#CE4B37" cx="128" cy="128" r="128"/>
    7 <path fill="#B3392D" d="M256,128C256,57.3,198.7,0,128,0v256C198.7,256,256,198.7,256,128z"/>
    8 <path fill="#FFFFFF" d="M128,74.8c-30,0-54.4,24.3-54.4,54.4S98,183.6,128,183.6s54.4-24.3,54.4-54.4S158,74.8,128,74.8z
    9      M119.3,115.7c-2.1,0-3.7,0.1-3.7,1.7c0,4.6,0,18.1-0.1,23.1c0,1.6,1.8,1.9,3.7,1.9l0,3.2l-10.6,0c0,0,0.1-26.7,0.1-28.2
    10     c0-1.6-1.8-1.8-3.6-1.8l0-3.1l14.2,0L119.3,115.7z M134.5,127.8c-1.2,0-3,0.1-3,1.4c0,0.8,0,10.2,0,11.8c0,1.1,0.8,1.4,1.7,1.5
    11     l1.3,0v0.1l0,3.1l-13,0l0-3.1l0-0.1l1.2,0c0.9-0.1,1.7-0.4,1.8-1.2c0-2.8,0-9.4,0-11.9c0-1.5-1.6-1.6-3-1.6l0-3.1l13,0L134.5,127.8z
    12      M150.8,115.8c-1.8,0-3.6,0.1-3.6,1.7c0,1.5-0.1,28.2-0.1,28.2l-10.6,0l0-3.2c1.9,0,3.7-0.3,3.7-1.9c0-5,0-18.5,0.1-23.1
    13     c0-1.6-1.5-1.7-3.7-1.7l0-3.1l14.2,0L150.8,115.8z"/>
    14 <circle fill="#FFFFFF" cx="128.5" cy="35.4" r="15"/>
    15 <circle fill="#FFFFFF" cx="221" cy="128" r="15"/>
    16 <circle fill="#FFFFFF" cx="128.5" cy="221.1" r="15"/>
    17 <circle fill="#FFFFFF" cx="38.7" cy="128" r="15"/>
    18 <circle fill="#FFFFFF" cx="62.7" cy="63.3" r="15"/>
    19 <circle fill="#FFFFFF" cx="196.4" cy="63.3" r="15"/>
    20 <circle fill="#FFFFFF" cx="61.7" cy="195.1" r="15"/>
    21 <circle fill="#FFFFFF" cx="196.4" cy="195.1" r="15"/>
     3<circle fill="#CE4B37" cx="128" cy="128" r="125"/>
     4<path fill="#B3392D" d="M253,128C253,59,197,3,128,3v250C197,253,253,197,253,128z"/>
     5<path fill="#FFFFFF" d="M128,76.1c-29.3,0-53.1,23.8-53.1,53.1s23.8,53.1,53.1,53.1s53.1-23.8,53.1-53.1S157.3,76.1,128,76.1z"/>
     6<circle fill="#FFFFFF" cx="128.5" cy="37.6" r="14.6"/>
     7<circle fill="#FFFFFF" cx="218.8" cy="128" r="14.6"/>
     8<circle fill="#FFFFFF" cx="128.5" cy="218.9" r="14.6"/>
     9<circle fill="#FFFFFF" cx="40.8" cy="128" r="14.6"/>
     10<circle fill="#FFFFFF" cx="64.3" cy="64.9" r="14.6"/>
     11<circle fill="#FFFFFF" cx="194.8" cy="64.9" r="14.6"/>
     12<circle fill="#FFFFFF" cx="63.3" cy="193.5" r="14.6"/>
     13<circle fill="#FFFFFF" cx="194.8" cy="193.5" r="14.6"/>
     14<g>
     15    <path fill="#CD4731" stroke="#CD4731" stroke-width="0.5769" stroke-miterlimit="10" d="M132.5,122.1c1.4-4.9,1.3-5.6-2.2-5.6v-0.6
     16        h9.2v0.6c-2.6,0-4.1,0.7-5.3,5.1l-7.6,26.7l-9-23.2l-8.4,23.2h-0.2l-8.2-29.2c-0.4-1.6-1.5-2.5-4-2.5v-0.6h9.2v0.6
     17        c-2.4,0-3.3,0.4-2.8,2.4l6.5,24l8.2-23.2h0.1l8.6,23.1L132.5,122.1z"/>
     18    <path fill="#CD4731" stroke="#CD4731" stroke-width="0.5769" stroke-miterlimit="10" d="M147.4,118.7c0-1.7-0.7-2.2-3.9-2.2v-0.6
     19        h10.1v0.6c-3.2,0-3.9,0.5-3.9,2.2v25.1c0,1.7,0.7,2.4,3.9,2.4v0.6h-10.1v-0.6c3.2,0,3.9-0.7,3.9-2.4V118.7z"/>
     20</g>
    2221</svg>
  • nonprofit-board-management/trunk/nonprofit-board-management.php

    r2506970 r2591584  
    55Domain Path: /languages
    66Description: A simple, free way to manage your nonprofit’s board.
    7 Version: 1.1.16
     7Version: 1.1.17
    88Author: Wired Impact
    99Author URI: https://wiredimpact.com/?utm_source=wordpress_admin&utm_medium=plugins_page&utm_campaign=nonprofit_board_management
     
    6060        add_action( 'wp_initialize_site', array( $this, 'multisite_activate_plugin' ) );
    6161
    62         if( is_admin() ){
    63           add_action( 'wp_dashboard_setup', array( $this, 'remove_dashboard_widgets' ) );
    64 
    65           //Setup top level menu
    66           add_action( 'admin_menu', array( $this, 'create_menu' ), 10 );
    67 
    68           //Load CSS and JS
    69           add_action( 'admin_enqueue_scripts', array( $this, 'insert_css') );
    70           add_action( 'admin_enqueue_scripts', array( $this, 'insert_js') );
    71 
    72           //Add our board members dashboard widget
    73           add_action('wp_dashboard_setup', array( $this, 'add_board_members_dashboard_widget' ) );
    74 
    75           //Remove the help tabs for all board members
    76           add_action( 'in_admin_header', array( $this, 'remove_help_tabs' ) );
    77 
    78           //Add notice to admin who can't serve on board in case they want to.
    79           add_action( 'admin_notices', array( $this, 'show_admins_notices' ) );
    80 
    81           //Allow admin to click a button and start serving on the board.
    82           add_action( 'wp_ajax_allow_user_to_serve', array( $this, 'allow_user_to_serve' ) );
    83         }
     62        if ( is_admin() ) {
     63            add_action( 'wp_dashboard_setup', array( $this, 'remove_dashboard_widgets' ) );
     64
     65            // Setup top level menu.
     66            add_action( 'admin_menu', array( $this, 'create_menu' ), 10 );
     67
     68            // Load CSS and JS.
     69            add_action( 'admin_enqueue_scripts', array( $this, 'insert_css') );
     70            add_action( 'admin_enqueue_scripts', array( $this, 'insert_js') );
     71
     72            // Add our board members dashboard widget.
     73            add_action( 'wp_dashboard_setup', array( $this, 'add_board_members_dashboard_widget' ) );
     74
     75            // Remove the help tabs for all board members.
     76            add_action( 'in_admin_header', array( $this, 'remove_help_tabs' ) );
     77
     78            // Add notice to admin who can't serve on board in case they want to.
     79            add_action( 'admin_notices', array( $this, 'show_admins_notices' ) );
     80
     81            // Allow admin to click a button and start serving on the board.
     82            add_action( 'wp_ajax_allow_user_to_serve', array( $this, 'allow_user_to_serve' ) );
     83
     84            // Used to check if a multisite super admin specifically has the 'serve_on_board' capability.
     85            if ( is_multisite() ) {
     86                add_filter( 'map_meta_cap', array( $this, 'check_serve_on_board_capability' ), 10, 3 );
     87            }
     88        }
    8489
    8590        //Redirect board members to dashboard on login.
     
    874879   }
    875880
     881   /**
     882    * This function only runs on multisites and denies the 'serve_on_board' capability
     883    * if the capability isn't set.
     884    *
     885    * This is needed because current_user_can() will always return true if the current
     886    * user is a super admin, unless specifically denied.
     887    *
     888    * @param array  $caps Primitive capabilities required of the user.
     889    * @param string $cap Capability being checked.
     890    * @param int    $user_id The user ID.
     891    *
     892    * @return array The filtered capabilities.
     893    */
     894    public function check_serve_on_board_capability( $caps, $cap, $user_id ) {
     895
     896        // Only filter the 'serve_on_board' capability.
     897        if ( 'serve_on_board' === $cap ) {
     898   
     899            $user      = get_userdata( $user_id );
     900            $user_caps = $user->get_role_caps();
     901   
     902            /**
     903             * If the user does not have the capability, then add do_not_allow.
     904             * Without this, a super admin in a multisite has no way of adding
     905             * themselves as a Board Member.
     906             */
     907            if ( empty( $user_caps[ $cap ] ) ) {
     908   
     909                $caps[] = 'do_not_allow';
     910            }
     911        }
     912   
     913        return $caps;
     914    }
     915
    876916
    877917   /*
  • nonprofit-board-management/trunk/readme.txt

    r2514407 r2591584  
    33Tags: nonprofits, boards, non profits, non-profits, directors, 501c3, 501(c)3, board governance
    44Requires at least: 3.0
    5 Tested up to: 5.7
    6 Stable tag: 1.1.16
     5Tested up to: 5.8
     6Stable tag: 1.1.17
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/lgpl-3.0.html
     
    105105== Changelog ==
    106106
     107= 1.1.17 =
     108* Fixed bug that prevented a super admin of a multisite from adding themselves as a board member.
     109* Tested up to WordPress 5.8.
     110
    107111= 1.1.16 =
    108112* Fixed the Board Member role not being available on subsites of a multisite installation if the plugin was network activated.
Note: See TracChangeset for help on using the changeset viewer.