WordPress.org

Plugin Directory

Changeset 1737967


Ignore:
Timestamp:
09/28/17 19:26:55 (3 months ago)
Author:
greenshady
Message:

Version 2.0.1 of the Members plugin.

Location:
members
Files:
81 added
10 edited

Legend:

Unmodified
Added
Removed
  • members/trunk/admin/class-meta-box-content-permissions.php

    r1699146 r1737967  
    199199                                <label> 
    200200                                    <input type="checkbox" name="members_access_role[]" <?php checked( is_array( $roles ) && in_array( $role, $roles ) ); ?> value="<?php echo esc_attr( $role ); ?>" /> 
    201                                     <?php echo esc_html( translate_user_role( $name ) ); ?> 
     201                                    <?php echo esc_html( members_translate_role( $role ) ); ?> 
    202202                                </label> 
    203203                            </li> 
  • members/trunk/admin/class-user-edit.php

    r1699146 r1737967  
    173173 
    174174            // Loop through the current user roles. 
    175             foreach ( (array) $user->roles as $old_role ) { 
     175            foreach ( (array) $old_user_data->roles as $old_role ) { 
    176176 
    177177                // Remove the role if it is editable. 
  • members/trunk/admin/class-user-new.php

    r1699146 r1737967  
    4949 
    5050        // If multiple roles per user is not enabled, bail. 
    51         if ( ! members_multiple_user_roles_enabled() ) 
     51        // 
     52        // @since 2.0.1 Added a check to not run on multisite. 
     53        // @link https://github.com/justintadlock/members/issues/153 
     54        if ( ! members_multiple_user_roles_enabled() || is_multisite() ) 
    5255            return; 
    5356 
    5457        // Only run our customization on the 'user-edit.php' page in the admin. 
    5558        add_action( 'load-user-new.php', array( $this, 'load' ) ); 
     59 
     60        // Sets the new user's roles. 
     61        add_action( 'user_register', array( $this, 'user_register' ), 5 ); 
    5662    } 
    5763 
     
    6773        // Adds the profile fields. 
    6874        add_action( 'user_new_form', array( $this, 'profile_fields' ) ); 
    69  
    70         // Sets the new user's roles. 
    71         add_action( 'user_register', array( $this, 'user_register' ) ); 
    7275 
    7376        // Handle scripts. 
  • members/trunk/admin/views/class-view-general.php

    r1699146 r1737967  
    100100        $settings['role_manager']         = ! empty( $settings['role_manager'] )         ? true : false; 
    101101        $settings['explicit_denied_caps'] = ! empty( $settings['explicit_denied_caps'] ) ? true : false; 
     102        $settings['show_human_caps']      = ! empty( $settings['show_human_caps'] )      ? true : false; 
    102103        $settings['multi_roles']          = ! empty( $settings['multi_roles'] )          ? true : false; 
    103104        $settings['content_permissions']  = ! empty( $settings['content_permissions'] )  ? true : false; 
  • members/trunk/changelog.md

    r1699146 r1737967  
    11# Change Log 
     2 
     3## [2.0.1] - 2017-09-28 
     4 
     5### Changed 
     6 
     7* Cap groups registered by the plugin bumped up 5 in priority. Primarily, this was to make sure post type cap groups were registered earlier than the default of `10`. 
     8* Better handling of the PHP notice.  We're going to check prior to loading any other code and add an admin notice if the site doesn't meet minimum requirements. 
     9 
     10### Fixed 
     11 
     12* The `show_human_caps` setting was not properly saving because it wasn't accounted for in the validation callback. 
     13* Make sure to use the correct `$old_user_data` variable when removing all roles from a user. Otherwise, this doesn't work. 
     14* Super admins should be able to see any private site when multisite is enabled. 
     15* Make sure that role labels (where the plugin outputs them) are the translated version. 
     16* Multi-role selection has been removed for the Add New User screen on multisite installs.  This was to address multiple issues in core with hardcoded values that the plugin couldn't filter.  The feature may return in the future in a different form.  Note that this doesn't change single-site installs. 
    217 
    318## [2.0.0] - 2017-07-19 
  • members/trunk/inc/functions-cap-groups.php

    r1699146 r1737967  
    8282                'caps'     => $has_caps, 
    8383                'icon'     => $icon, 
    84                 'priority' => 5 
     84                'priority' => 10 
    8585            ) 
    8686        ); 
     
    9494            'icon'       => 'dashicons-tag', 
    9595            'diff_added' => true, 
    96             'priority'   => 10 
     96            'priority'   => 15 
    9797        ) 
    9898    ); 
     
    103103            'label'    => esc_html__( 'Appearance', 'members' ), 
    104104            'icon'     => 'dashicons-admin-appearance', 
    105             'priority' => 15 
     105            'priority' => 20 
    106106        ) 
    107107    ); 
     
    112112            'label'    => esc_html__( 'Plugins', 'members' ), 
    113113            'icon'     => 'dashicons-admin-plugins', 
    114             'priority' => 20 
     114            'priority' => 25 
    115115        ) 
    116116    ); 
     
    121121            'label'    => esc_html__( 'Users', 'members' ), 
    122122            'icon'     => 'dashicons-admin-users', 
    123             'priority' => 25 
     123            'priority' => 30 
    124124        ) 
    125125    ); 
  • members/trunk/inc/functions-private-site.php

    r1699146 r1737967  
    7979function members_please_log_in() { 
    8080 
     81    // If private blog is not enabled, bail. 
     82    if ( ! members_is_private_blog() ) 
     83        return; 
     84 
    8185    // If this is a multisite instance and the user is logged into the network. 
    82     if ( members_is_private_blog() && is_multisite() && is_user_logged_in() && ! is_user_member_of_blog() ) { 
     86    if ( is_multisite() && is_user_logged_in() && ! is_user_member_of_blog() && ! is_super_admin() ) { 
    8387        members_ms_private_blog_die(); 
    8488    } 
    8589 
    8690    // Check if the private blog feature is active and if the user is not logged in. 
    87     if ( members_is_private_blog() && ! is_user_logged_in() && members_is_private_page() ) { 
     91    if ( ! is_user_logged_in() && members_is_private_page() ) { 
    8892 
    8993        auth_redirect(); 
  • members/trunk/inc/functions-roles.php

    r1699146 r1737967  
    4141 
    4242        $args = array( 
    43             'label' => $object['name'], 
     43            'label' => members_translate_role_hook( $object['name'], $name ), 
    4444            'caps'  => $object['capabilities'] 
    4545        ); 
     
    248248    global $wp_roles; 
    249249 
    250     return apply_filters( 'members_translate_role', translate_user_role( $wp_roles->role_names[ $role ] ), $role ); 
     250    return members_translate_role_hook( $wp_roles->role_names[ $role ], $role ); 
     251} 
     252 
     253/** 
     254 * Hook for translating user roles. I needed to separate this from the primary 
     255 * `members_translate_role()` function in case `$wp_roles` was not yet available 
     256 * but both the role and role label were. 
     257 * 
     258 * @since  2.0.1 
     259 * @access public 
     260 * @param  string  $label 
     261 * @param  string  $role 
     262 * @return string 
     263 */ 
     264function members_translate_role_hook( $label, $role ) { 
     265 
     266    return apply_filters( 'members_translate_role', translate_user_role( $label ), $role ); 
    251267} 
    252268 
  • members/trunk/members.php

    r1699146 r1737967  
    44 * Plugin URI:  https://themehybrid.com/plugins/members 
    55 * Description: A user and role management plugin that puts you in full control of your site's permissions. This plugin allows you to edit your roles and their capabilities, clone existing roles, assign multiple roles per user, block post content, or even make your site completely private. 
    6  * Version:     2.0.0 
     6 * Version:     2.0.1 
    77 * Author:      Justin Tadlock 
    88 * Author URI:  https://themehybrid.com 
    99 * Text Domain: members 
    10  * Domain Path: /languages 
     10 * Domain Path: /lang 
    1111 * 
    1212 * The members plugin was created because the WordPress community is lacking a solid permissions 
     
    2626 * 
    2727 * @package   Members 
    28  * @version   2.0.0 
     28 * @version   2.0.1 
    2929 * @author    Justin Tadlock <justintadlock@gmail.com> 
    3030 * @copyright Copyright (c) 2009 - 2017, Justin Tadlock 
     
    176176     */ 
    177177    private function includes() { 
     178 
     179        // Check if we meet the minimum PHP version. 
     180        if ( version_compare( PHP_VERSION, $this->php_version, '<' ) ) { 
     181 
     182            // Add admin notice. 
     183            add_action( 'admin_notices', array( $this, 'php_admin_notice' ) ); 
     184 
     185            // Bail. 
     186            return; 
     187        } 
    178188 
    179189        // Load class files. 
     
    279289 
    280290            // Add an error message and die. 
    281             wp_die( sprintf( 
    282                 __( 'Members requires PHP version %1$s. You are running version %2$s. Please upgrade and try again.', 'members' ), 
    283                 $this->php_version, 
    284                 PHP_VERSION 
    285             ) ); 
     291            wp_die( $this->get_min_php_message() ); 
    286292        } 
    287293 
     
    298304            $role->add_cap( 'restrict_content' ); // Edit per-post content permissions. 
    299305        } 
     306    } 
     307 
     308    /** 
     309     * Returns a message noting the minimum version of PHP required. 
     310     * 
     311     * @since  2.0.1 
     312     * @access private 
     313     * @return void 
     314     */ 
     315    private function get_min_php_message() { 
     316 
     317        return sprintf( 
     318            __( 'Members requires PHP version %1$s. You are running version %2$s. Please upgrade and try again.', 'members' ), 
     319            $this->php_version, 
     320            PHP_VERSION 
     321        ); 
     322    } 
     323 
     324    /** 
     325     * Outputs the admin notice that the user needs to upgrade their PHP version. It also 
     326     * auto-deactivates the plugin. 
     327     * 
     328     * @since  2.0.1 
     329     * @access public 
     330     * @return void 
     331     */ 
     332    public function php_admin_notice() { 
     333 
     334        // Output notice. 
     335        printf( 
     336            '<div class="notice notice-error is-dismissible"><p><strong>%s</strong></p></div>', 
     337            esc_html( $this->get_min_php_message() ) 
     338        ); 
     339 
     340        // Make sure the plugin is deactivated. 
     341        deactivate_plugins( plugin_basename( __FILE__ ) ); 
    300342    } 
    301343} 
  • members/trunk/readme.txt

    r1699146 r1737967  
    55Tags: capabilities, roles, members, users 
    66Requires at least: 4.7 
    7 Tested up to: 4.8 
    8 Stable tag: 2.0.0 
     7Tested up to: 4.8.2 
     8Requires PHP: 5.3 
     9Stable tag: 2.0.1 
     10License: GPLv2 or later 
     11License URI: http://www.gnu.org/licenses/gpl-2.0.html 
    912 
    1013The most powerful user, role, and capability management plugin for WordPress. 
Note: See TracChangeset for help on using the changeset viewer.