Groups - Version 1.3.5

Version Description

  • Fixed out of memory issues with large user bases on Users > All Users page. Thanks to Jason Glaspey who spotted the issue :)
Download this release

Release Info

Developer itthinx
Plugin Icon 128x128 Groups
Version 1.3.5
Comparing to
See all releases

Code changes from version 1.3.4 to 1.3.5

groups.php CHANGED
@@ -21,13 +21,13 @@
21
  * Plugin Name: Groups
22
  * Plugin URI: http://www.itthinx.com/plugins/groups
23
  * Description: Groups provides group-based user membership management, group-based capabilities and content access control.
24
- * Version: 1.3.4
25
  * Author: itthinx
26
  * Author URI: http://www.itthinx.com
27
  * Donate-Link: http://www.itthinx.com
28
  * License: GPLv3
29
  */
30
- define( 'GROUPS_CORE_VERSION', '1.3.4' );
31
  define( 'GROUPS_FILE', __FILE__ );
32
  if ( !defined( 'GROUPS_CORE_DIR' ) ) {
33
  define( 'GROUPS_CORE_DIR', WP_PLUGIN_DIR . '/groups' );
21
  * Plugin Name: Groups
22
  * Plugin URI: http://www.itthinx.com/plugins/groups
23
  * Description: Groups provides group-based user membership management, group-based capabilities and content access control.
24
+ * Version: 1.3.5
25
  * Author: itthinx
26
  * Author URI: http://www.itthinx.com
27
  * Donate-Link: http://www.itthinx.com
28
  * License: GPLv3
29
  */
30
+ define( 'GROUPS_CORE_VERSION', '1.3.5' );
31
  define( 'GROUPS_FILE', __FILE__ );
32
  if ( !defined( 'GROUPS_CORE_DIR' ) ) {
33
  define( 'GROUPS_CORE_DIR', WP_PLUGIN_DIR . '/groups' );
lib/admin/class-groups-admin-users.php CHANGED
@@ -150,11 +150,17 @@ class Groups_Admin_Users {
150
  public static function views_users( $views ) {
151
  global $pagenow, $wpdb;
152
  if ( ( $pagenow == 'users.php' ) && empty( $_GET['page'] ) ) {
153
- $group_table = _groups_get_tablename( "group" );
 
154
  $groups = $wpdb->get_results( "SELECT * FROM $group_table ORDER BY name" );
155
  foreach( $groups as $group ) {
156
  $group = new Groups_Group( $group->group_id );
157
- $user_count = count( $group->users );
 
 
 
 
 
158
  $views[] = sprintf(
159
  '<a class="group" href="%s" title="%s">%s</a>',
160
  esc_url( add_query_arg( 'group', $group->group_id, admin_url( 'users.php' ) ) ),
150
  public static function views_users( $views ) {
151
  global $pagenow, $wpdb;
152
  if ( ( $pagenow == 'users.php' ) && empty( $_GET['page'] ) ) {
153
+ $group_table = _groups_get_tablename( "group" );
154
+ $user_group_table = _groups_get_tablename( "user_group" );
155
  $groups = $wpdb->get_results( "SELECT * FROM $group_table ORDER BY name" );
156
  foreach( $groups as $group ) {
157
  $group = new Groups_Group( $group->group_id );
158
+ // Do not use $user_count = count( $group->users ); here,
159
+ // as it creates a lot of unneccessary objects and can lead
160
+ // to out of memory issues on large user bases.
161
+ $user_count = $wpdb->get_var( $wpdb->prepare(
162
+ "SELECT COUNT(user_id) FROM $user_group_table WHERE group_id = %d",
163
+ Groups_Utility::id( $group->group_id ) ) );
164
  $views[] = sprintf(
165
  '<a class="group" href="%s" title="%s">%s</a>',
166
  esc_url( add_query_arg( 'group', $group->group_id, admin_url( 'users.php' ) ) ),
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.itthinx.com/plugins/groups
4
  Tags: access, access control, capability, capabilities, content, download, downloads, file, file access, files, group, groups, member, members, membership, memberships, paypal, permission, permissions, subscription, subscriptions, woocommerce
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
- Stable tag: 1.3.4
8
  License: GPLv3
9
 
10
  Groups provides group-based user membership management, group-based capabilities and content access control.
@@ -322,6 +322,9 @@ See also [Groups](http://www.itthinx.com/plugins/groups/)
322
 
323
  == Changelog ==
324
 
 
 
 
325
  = 1.3.4 =
326
  * WP 3.5 cosmetics
327
 
@@ -417,6 +420,9 @@ Some installations wouldn't work correctly, showing no capabilities and making i
417
 
418
  == Upgrade Notice ==
419
 
 
 
 
420
  = 1.3.4 =
421
  * Please upgrade for WordPress 3.5 compatibility & cosmetics.
422
 
4
  Tags: access, access control, capability, capabilities, content, download, downloads, file, file access, files, group, groups, member, members, membership, memberships, paypal, permission, permissions, subscription, subscriptions, woocommerce
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
+ Stable tag: 1.3.5
8
  License: GPLv3
9
 
10
  Groups provides group-based user membership management, group-based capabilities and content access control.
322
 
323
  == Changelog ==
324
 
325
+ = 1.3.5 =
326
+ * Fixed out of memory issues with large user bases on Users > All Users page. Thanks to [Jason Glaspey](http://www.jasonglaspey.com) who spotted the issue :)
327
+
328
  = 1.3.4 =
329
  * WP 3.5 cosmetics
330
 
420
 
421
  == Upgrade Notice ==
422
 
423
+ = 1.3.5 =
424
+ * Fixed out of memory issues with large user bases on Users > All Users page.
425
+
426
  = 1.3.4 =
427
  * Please upgrade for WordPress 3.5 compatibility & cosmetics.
428