Skip to content

Commit

Permalink
Merge pull request #90 from itthinx/pre-2.4.0
Browse files Browse the repository at this point in the history
Pre 2.4.0
  • Loading branch information
itthinx authored Sep 30, 2018
2 parents d8330da + 7f04aa9 commit 959e5a9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 26 deletions.
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
== Groups by itthinx - changelog.txt ==

= 2.4.0 =
* Improved performance when filtering the users list by groups to avoid issues with large user bases.
* Tested with the latest WordPress 4.9.
* Updated the minimum required WordPress version to 4.6.
* Fixed a missing Javascript resource when selecting an image in the customizer.

= 2.3.1 =
* Fixed several points where warnings related to the use of count() and the Countable interface would occur due to changes in PHP 7.2.
* Tested with WordPress 4.9.
Expand Down
4 changes: 2 additions & 2 deletions groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Plugin Name: Groups
* Plugin URI: http://www.itthinx.com/plugins/groups
* Description: Groups provides group-based user membership management, group-based capabilities and content access control.
* Version: 2.3.1
* Version: 2.4.0
* Author: itthinx
* Author URI: http://www.itthinx.com
* Donate-Link: http://www.itthinx.com
Expand All @@ -32,7 +32,7 @@
if ( !defined( 'ABSPATH' ) ) {
exit;
}
define( 'GROUPS_CORE_VERSION', '2.3.1' );
define( 'GROUPS_CORE_VERSION', '2.4.0' );
define( 'GROUPS_FILE', __FILE__ );
if ( !defined( 'GROUPS_CORE_DIR' ) ) {
define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
Expand Down
9 changes: 7 additions & 2 deletions lib/access/class-groups-access-meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,13 @@ public static function admin_init() {
*/
public static function admin_enqueue_scripts() {
global $pagenow;
if ( $pagenow == 'upload.php' ) {
Groups_UIE::enqueue( 'select' );
if ( isset( $pagenow ) ) {
switch ( $pagenow ) {
case 'upload.php' :
case 'customize.php' :
Groups_UIE::enqueue( 'select' );
break;
}
}
}

Expand Down
28 changes: 9 additions & 19 deletions lib/admin/class-groups-admin-users.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,17 @@ public static function pre_user_query( $user_query ) {
global $pagenow, $wpdb;
if ( ( $pagenow == 'users.php' ) && empty( $_GET['page'] ) ) {
if ( isset( $_REQUEST['group_ids'] ) && is_array( $_REQUEST['group_ids'] ) ) {
$group_ids = array_map( array( 'Groups_Utility', 'id' ), array_map( 'trim', $_REQUEST['group_ids'] ) );
$include = array();
foreach ( $group_ids as $group_id ) {
if ( Groups_Group::read( $group_id ) ) {
$group = new Groups_Group( $group_id );
$users = $group->users;
if ( count( $users ) > 0 ) {
foreach( $users as $user ) {
$include[] = $user->user->ID;
}
} else { // no results
$include[] = 0;
}
unset( $group );
unset( $users );
$group_ids = array();
foreach ( $_REQUEST['group_ids'] as $group_id ) {
$group_id = Groups_Utility::id( $group_id );
if ( $group_id !== false ) {
$group_ids[] = $group_id;
}
}
if ( count( $include ) > 0 ) {
$include = array_unique( $include );
$ids = implode( ',', wp_parse_id_list( $include ) );
$user_query->query_where .= " AND $wpdb->users.ID IN ($ids)";
if ( count( $group_ids ) > 0 ) {
$user_group_table = _groups_get_tablename( 'user_group' );
$group_ids = implode( ',', esc_sql( $group_ids ) );
$user_query->query_where .= " AND $wpdb->users.ID IN ( SELECT DISTINCT user_id FROM $user_group_table WHERE group_id IN ( $group_ids ) ) ";
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Contributors: itthinx, proaktion
Donate link: http://www.itthinx.com/plugins/groups
Tags: groups, access, access control, membership, memberships, member, members, capability, capabilities, content, download, downloads, file, file access, files, paypal, permission, permissions, subscription, subscriptions, woocommerce
Requires at least: 4.0
Requires at least: 4.6
Tested up to: 4.9
Requires PHP: 5.5.38
Stable tag: 2.3.1
Stable tag: 2.4.0
License: GPLv3

Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
Expand Down Expand Up @@ -190,6 +190,12 @@ See also the [Groups Documentation](http://docs.itthinx.com/document/groups/) pa

== Changelog ==

= 2.4.0 =
* Improved performance when filtering the users list by groups to avoid issues with large user bases.
* Tested with the latest WordPress 4.9.
* Updated the minimum required WordPress version to 4.6.
* Fixed a missing Javascript resource when selecting an image in the customizer.

= 2.3.1 =
* Fixed several points where warnings related to the use of count() and the Countable interface would occur due to changes in PHP 7.2.
* Tested with WordPress 4.9.
Expand Down Expand Up @@ -286,4 +292,4 @@ See also the [Groups Documentation](http://docs.itthinx.com/document/groups/) pa

== Upgrade Notice ==

This release has been tested with WordPress 4.9 and contains several fixes for compatibility with PHP 7.2, fixes related to post filtering and an improved notice handling.
This release has been tested with WordPress 4.9 and Groups now requires at least WordPress 4.6. It contains fixes related to performance and scripts.

0 comments on commit 959e5a9

Please sign in to comment.