Groups - Version 1.5.3

Version Description

  • Added a comparison method for groups and capabilities.
  • Updated the documentation link in the help content.
Download this release

Release Info

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

Code changes from version 1.5.2 to 1.5.3

groups.php CHANGED
@@ -21,7 +21,7 @@
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.5.2
25
  * Author: itthinx
26
  * Author URI: http://www.itthinx.com
27
  * Donate-Link: http://www.itthinx.com
@@ -30,7 +30,7 @@
30
  if ( !defined( 'ABSPATH' ) ) {
31
  exit;
32
  }
33
- define( 'GROUPS_CORE_VERSION', '1.5.2' );
34
  define( 'GROUPS_FILE', __FILE__ );
35
  if ( !defined( 'GROUPS_CORE_DIR' ) ) {
36
  define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
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.5.3
25
  * Author: itthinx
26
  * Author URI: http://www.itthinx.com
27
  * Donate-Link: http://www.itthinx.com
30
  if ( !defined( 'ABSPATH' ) ) {
31
  exit;
32
  }
33
+ define( 'GROUPS_CORE_VERSION', '1.5.3' );
34
  define( 'GROUPS_FILE', __FILE__ );
35
  if ( !defined( 'GROUPS_CORE_DIR' ) ) {
36
  define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
lib/admin/groups-admin-groups-edit.php CHANGED
@@ -138,7 +138,7 @@ function groups_admin_groups_edit( $group_id ) {
138
  $group_capabilities = $group_object->capabilities;
139
  $group_capabilities_deep = $group_object->capabilities_deep;
140
  if ( ( count( $group_capabilities_deep ) - count( $group_capabilities ) ) > 0 ) {
141
- usort( $group_capabilities_deep, 'groups_admin_sort_capabilities_by_capability' );
142
  $output .= '<div class="field">';
143
  $output .= __( 'Inherited capabilities:', GROUPS_PLUGIN_DOMAIN );
144
  $output .= ' ';
@@ -248,15 +248,3 @@ function groups_admin_groups_edit_submit() {
248
  }
249
 
250
  } // function groups_admin_groups_edit_submit
251
-
252
- if ( !function_exists( 'groups_admin_sort_capabilities_by_capability' ) ) {
253
- /**
254
- * usort helper
255
- * @param Groups_Capability $o1
256
- * @param Groups_Capability $o2
257
- * @return int strcmp result for group names
258
- */
259
- function groups_admin_sort_capabilities_by_capability( $o1, $o2 ) {
260
- return strcmp( $o1->capability->capability, $o2->capability->capability );
261
- }
262
- }
138
  $group_capabilities = $group_object->capabilities;
139
  $group_capabilities_deep = $group_object->capabilities_deep;
140
  if ( ( count( $group_capabilities_deep ) - count( $group_capabilities ) ) > 0 ) {
141
+ usort( $group_capabilities_deep, array( 'Groups_Utility', 'cmp' ) );
142
  $output .= '<div class="field">';
143
  $output .= __( 'Inherited capabilities:', GROUPS_PLUGIN_DOMAIN );
144
  $output .= ' ';
248
  }
249
 
250
  } // function groups_admin_groups_edit_submit
 
 
 
 
 
 
 
 
 
 
 
 
lib/admin/groups-admin-groups.php CHANGED
@@ -430,7 +430,7 @@ function groups_admin_groups() {
430
  $group = new Groups_Group( $result->group_id );
431
  $group_capabilities = $group->capabilities;
432
  $group_capabilities_deep = $group->capabilities_deep;
433
- usort( $group_capabilities_deep, 'groups_admin_sort_capabilities_by_capability' );
434
 
435
  if ( count( $group_capabilities_deep ) > 0 ) {
436
  $output .= '<ul>';
@@ -488,15 +488,3 @@ function groups_admin_groups() {
488
  echo $output;
489
  Groups_Help::footer();
490
  } // function groups_admin_groups()
491
-
492
- if ( !function_exists( 'groups_admin_sort_capabilities_by_capability' ) ) {
493
- /**
494
- * usort helper
495
- * @param Groups_Capability $o1
496
- * @param Groups_Capability $o2
497
- * @return int strcmp result for group names
498
- */
499
- function groups_admin_sort_capabilities_by_capability( $o1, $o2 ) {
500
- return strcmp( $o1->capability->capability, $o2->capability->capability );
501
- }
502
- }
430
  $group = new Groups_Group( $result->group_id );
431
  $group_capabilities = $group->capabilities;
432
  $group_capabilities_deep = $group->capabilities_deep;
433
+ usort( $group_capabilities_deep, array( 'Groups_Utility', 'cmp' ) );
434
 
435
  if ( count( $group_capabilities_deep ) > 0 ) {
436
  $output .= '<ul>';
488
  echo $output;
489
  Groups_Help::footer();
490
  } // function groups_admin_groups()
 
 
 
 
 
 
 
 
 
 
 
 
lib/core/class-groups-help.php CHANGED
@@ -82,7 +82,7 @@ class Groups_Help {
82
  if ( $show_groups_help ) {
83
  $help = '<h3><a href="http://www.itthinx.com/plugins/groups" target="_blank">'. $help_title .'</a></h3>';
84
  $help .= '<p>';
85
- $help .= __( 'The complete documentation is available on the <a href="http://www.itthinx.com/plugins/groups" target="_blank">Groups plugin page</a>', GROUPS_PLUGIN_DOMAIN );
86
  $help .= '</p>';
87
  switch ( $screen_id ) {
88
  case 'groups-admin' :
82
  if ( $show_groups_help ) {
83
  $help = '<h3><a href="http://www.itthinx.com/plugins/groups" target="_blank">'. $help_title .'</a></h3>';
84
  $help .= '<p>';
85
+ $help .= __( 'The complete documentation is available on the <a href="http://docs.itthinx.com/document/groups">Documentation</a> pages for Groups.', GROUPS_PLUGIN_DOMAIN );
86
  $help .= '</p>';
87
  switch ( $screen_id ) {
88
  case 'groups-admin' :
lib/core/class-groups-utility.php CHANGED
@@ -115,4 +115,23 @@ class Groups_Utility {
115
  }
116
  $output .= '</ul>';
117
  }
118
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  }
116
  $output .= '</ul>';
117
  }
118
+
119
+ /**
120
+ * Compares the two object's names, used for groups and
121
+ * capabilities, i.e. Groups_Group and Groups_Capability can be compared
122
+ * if both are of the same class. Otherwise this will return 0.
123
+ *
124
+ * @param Groups_Group|Groups_Capability $o1
125
+ * @param Groups_Group|Groups_Capability $o2 must match the class of $o1
126
+ * @return number
127
+ */
128
+ public static function cmp( $o1, $o2 ) {
129
+ $result = 0;
130
+ if ( $o1 instanceof Groups_Group && $o2 instanceof Groups_Group ) {
131
+ $result = strcmp( $o1->name, $o2->name );
132
+ } else if ( $o1 instanceof Groups_Capability && $o2 instanceof Groups_Capability ) {
133
+ $result = strcmp( $o1->capability->capability, $o2->capability->capability );
134
+ }
135
+ return $result;
136
+ }
137
+ }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: itthinx
3
  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: 4.0
6
- Tested up to: 4.2.1
7
- Stable tag: 1.5.2
8
  License: GPLv3
9
 
10
  Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
@@ -177,6 +177,10 @@ See also [Groups](http://www.itthinx.com/plugins/groups/)
177
 
178
  == Changelog ==
179
 
 
 
 
 
180
  = 1.5.2 =
181
  * Improved internal definitions to use API function instead of WP_CONTENT_DIR
182
  and WP_CONTENT_URL constants.
@@ -444,5 +448,5 @@ Some installations wouldn't work correctly, showing no capabilities and making i
444
 
445
  == Upgrade Notice ==
446
 
447
- = 1.5.2 =
448
- This release improves some user interface elements, some internal definitions and now shows inherited capabilities for groups.
3
  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: 4.0
6
+ Tested up to: 4.2.2
7
+ Stable tag: 1.5.3
8
  License: GPLv3
9
 
10
  Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
177
 
178
  == Changelog ==
179
 
180
+ = 1.5.3 =
181
+ * Added a comparison method for groups and capabilities.
182
+ * Updated the documentation link in the help content.
183
+
184
  = 1.5.2 =
185
  * Improved internal definitions to use API function instead of WP_CONTENT_DIR
186
  and WP_CONTENT_URL constants.
448
 
449
  == Upgrade Notice ==
450
 
451
+ = 1.5.3 =
452
+ This release improves the internally used utility API.