Groups - Version 2.13.0

Version Description

Download this release

Release Info

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

Code changes from version 2.12.0 to 2.13.0

Files changed (37) hide show
  1. changelog.txt +7 -0
  2. groups.php +2 -2
  3. images/add-ons/groups-paypal.png +0 -0
  4. legacy/access/class-groups-access-meta-boxes-legacy.php +9 -9
  5. legacy/access/class-groups-post-access-legacy.php +19 -19
  6. legacy/admin/class-groups-admin-post-columns-legacy.php +2 -2
  7. legacy/admin/class-groups-admin-posts-legacy.php +3 -3
  8. lib/access/class-groups-access-shortcodes.php +2 -2
  9. lib/access/class-groups-post-access.php +22 -22
  10. lib/admin/class-groups-admin-notice.php +3 -3
  11. lib/admin/class-groups-admin-post-columns.php +4 -4
  12. lib/admin/class-groups-admin-posts.php +3 -3
  13. lib/admin/class-groups-admin-user-profile.php +5 -5
  14. lib/admin/class-groups-admin-users.php +5 -5
  15. lib/admin/class-groups-admin.php +4 -4
  16. lib/admin/groups-admin-add-ons.php +1 -8
  17. lib/auto/class-groups-registered.php +4 -4
  18. lib/core/class-groups-cache-object.php +4 -4
  19. lib/core/class-groups-cache.php +5 -5
  20. lib/core/class-groups-capability.php +11 -11
  21. lib/core/class-groups-controller.php +3 -3
  22. lib/core/class-groups-group-capability.php +6 -6
  23. lib/core/class-groups-group.php +36 -26
  24. lib/core/class-groups-options.php +10 -28
  25. lib/core/class-groups-pagination.php +10 -10
  26. lib/core/class-groups-user-capability.php +5 -5
  27. lib/core/class-groups-user-group.php +12 -12
  28. lib/core/class-groups-user.php +3 -3
  29. lib/core/class-groups-utility.php +1 -1
  30. lib/core/constants.php +1 -1
  31. lib/core/interface-i-capable.php +2 -2
  32. lib/extra/class-groups-extra.php +2 -2
  33. lib/test/groups-tests.php +4 -4
  34. lib/views/class-groups-shortcodes.php +6 -6
  35. lib/views/class-groups-uie.php +3 -3
  36. lib/wp/class-groups-wordpress.php +3 -3
  37. readme.txt +2 -2
changelog.txt CHANGED
@@ -1,5 +1,12 @@
1
  == Groups by itthinx - changelog.txt
2
 
 
 
 
 
 
 
 
3
  = 2.12.0 =
4
  * WordPress 5.6 compatible.
5
  * Updated info on add-ons.
1
  == Groups by itthinx - changelog.txt
2
 
3
+ = 2.13.0 =
4
+ * WordPress 5.7 compatible.
5
+ * Removed unnecessary magic method overrides in Groups_Options (also eliminates PHP 8 warning for __wakeup()).
6
+ * Added missing scope declarations to Groups_Pagination methods.
7
+ * Fixed potential issues when creating a group programmatically indicating the group's parent ID.
8
+ * Code-formatting clean-up: trailing spaces.
9
+
10
  = 2.12.0 =
11
  * WordPress 5.6 compatible.
12
  * Updated info on add-ons.
groups.php CHANGED
@@ -21,7 +21,7 @@
21
  * Plugin Name: Groups
22
  * Plugin URI: https://www.itthinx.com/plugins/groups
23
  * Description: Groups provides group-based user membership management, group-based capabilities and content access control.
24
- * Version: 2.12.0
25
  * Author: itthinx
26
  * Author URI: https://www.itthinx.com
27
  * Donate-Link: https://www.itthinx.com/shop/
@@ -32,7 +32,7 @@
32
  if ( !defined( 'ABSPATH' ) ) {
33
  exit;
34
  }
35
- define( 'GROUPS_CORE_VERSION', '2.12.0' );
36
  define( 'GROUPS_FILE', __FILE__ );
37
  if ( !defined( 'GROUPS_CORE_DIR' ) ) {
38
  define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
21
  * Plugin Name: Groups
22
  * Plugin URI: https://www.itthinx.com/plugins/groups
23
  * Description: Groups provides group-based user membership management, group-based capabilities and content access control.
24
+ * Version: 2.13.0
25
  * Author: itthinx
26
  * Author URI: https://www.itthinx.com
27
  * Donate-Link: https://www.itthinx.com/shop/
32
  if ( !defined( 'ABSPATH' ) ) {
33
  exit;
34
  }
35
+ define( 'GROUPS_CORE_VERSION', '2.13.0' );
36
  define( 'GROUPS_FILE', __FILE__ );
37
  if ( !defined( 'GROUPS_CORE_DIR' ) ) {
38
  define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
images/add-ons/groups-paypal.png DELETED
Binary file
legacy/access/class-groups-access-meta-boxes-legacy.php CHANGED
@@ -27,7 +27,7 @@ require_once GROUPS_LEGACY_LIB . '/access/class-groups-post-access-legacy.php';
27
 
28
  /**
29
  * Adds meta boxes to edit screens.
30
- *
31
  * @link http://codex.wordpress.org/Function_Reference/add_meta_box
32
  */
33
  class Groups_Access_Meta_Boxes_Legacy {
@@ -132,7 +132,7 @@ class Groups_Access_Meta_Boxes_Legacy {
132
  __( 'Note that you must be a member of a group that has such a capability assigned.', 'groups' ) .
133
  '</p>' .
134
  '<p>' .
135
- '<strong>' . __( 'Example:', 'groups' ) . '</strong>' .
136
  '</p>' .
137
  __( 'Let\'s assume that you want to limit the visibility of a post to members of the <em>Premium</em> group.', 'groups' ) .
138
  '<p>' .
@@ -158,7 +158,7 @@ class Groups_Access_Meta_Boxes_Legacy {
158
  '<li>' . __( 'Go to <strong>Groups > Groups</strong> and assign the <em>premium</em> capability to the <em>Premium</em> group.', 'groups' ) . '</li>' .
159
  '<li>' . __( 'Go to <strong>Groups > Options</strong> and enable the <em>premium</em> capability to restrict access.', 'groups' ) . '</li>' .
160
  '<li>' . __( 'Become a member of the <em>Premium</em> group - this is required so you can choose the <em>premium</em> capability to restrict access to a post.', 'groups' ) . '</li>' .
161
- '<li>' . __( 'Edit the post for which you want to restrict access and choose<sup>*</sup> the <em>premium</em> capability.', 'groups' ) . '</li>' .
162
  '</ol>' .
163
  '<p>' .
164
  __( '<sup>*</sup> For each capability, the groups that have the capability assigned are shown within parenthesis. You can choose a capability by typing part of the group\'s or the capability\'s name.', 'groups' ) .
@@ -172,9 +172,9 @@ class Groups_Access_Meta_Boxes_Legacy {
172
 
173
  /**
174
  * Render meta box for capabilities.
175
- *
176
  * @see do_meta_boxes()
177
- *
178
  * @param Object $object
179
  * @param Object $box
180
  */
@@ -333,7 +333,7 @@ class Groups_Access_Meta_Boxes_Legacy {
333
  * At WordPress 3.6.1, this is the only way we can achieve that, because
334
  * the save_post action is not invoked if the post content is considered
335
  * empty.
336
- *
337
  * @param boolean $maybe_empty
338
  * @param array $postarr
339
  * @return boolean
@@ -360,7 +360,7 @@ class Groups_Access_Meta_Boxes_Legacy {
360
 
361
  /**
362
  * Save capability options.
363
- *
364
  * @param int $post_id
365
  * @param mixed $post post data (not used here)
366
  */
@@ -378,7 +378,7 @@ class Groups_Access_Meta_Boxes_Legacy {
378
  // See http://codex.wordpress.org/Function_Reference/current_user_can 20130119 WP 3.5
379
  // "... Some capability checks (like 'edit_post' or 'delete_page') require this [the post ID] be provided."
380
  // If the post ID is not provided, it will throw:
381
- // PHP Notice: Undefined offset: 0 in /var/www/groups-forums/wp-includes/capabilities.php on line 1067
382
  $edit_post_type = 'edit_' . $post_type;
383
  if ( $post_type_object = get_post_type_object( $post_type ) ) {
384
  if ( !isset( $post_type_object->capabilities ) ) {
@@ -678,5 +678,5 @@ class Groups_Access_Meta_Boxes_Legacy {
678
  }
679
  return $result;
680
  }
681
- }
682
  Groups_Access_Meta_Boxes_Legacy::init();
27
 
28
  /**
29
  * Adds meta boxes to edit screens.
30
+ *
31
  * @link http://codex.wordpress.org/Function_Reference/add_meta_box
32
  */
33
  class Groups_Access_Meta_Boxes_Legacy {
132
  __( 'Note that you must be a member of a group that has such a capability assigned.', 'groups' ) .
133
  '</p>' .
134
  '<p>' .
135
+ '<strong>' . __( 'Example:', 'groups' ) . '</strong>' .
136
  '</p>' .
137
  __( 'Let\'s assume that you want to limit the visibility of a post to members of the <em>Premium</em> group.', 'groups' ) .
138
  '<p>' .
158
  '<li>' . __( 'Go to <strong>Groups > Groups</strong> and assign the <em>premium</em> capability to the <em>Premium</em> group.', 'groups' ) . '</li>' .
159
  '<li>' . __( 'Go to <strong>Groups > Options</strong> and enable the <em>premium</em> capability to restrict access.', 'groups' ) . '</li>' .
160
  '<li>' . __( 'Become a member of the <em>Premium</em> group - this is required so you can choose the <em>premium</em> capability to restrict access to a post.', 'groups' ) . '</li>' .
161
+ '<li>' . __( 'Edit the post for which you want to restrict access and choose<sup>*</sup> the <em>premium</em> capability.', 'groups' ) . '</li>' .
162
  '</ol>' .
163
  '<p>' .
164
  __( '<sup>*</sup> For each capability, the groups that have the capability assigned are shown within parenthesis. You can choose a capability by typing part of the group\'s or the capability\'s name.', 'groups' ) .
172
 
173
  /**
174
  * Render meta box for capabilities.
175
+ *
176
  * @see do_meta_boxes()
177
+ *
178
  * @param Object $object
179
  * @param Object $box
180
  */
333
  * At WordPress 3.6.1, this is the only way we can achieve that, because
334
  * the save_post action is not invoked if the post content is considered
335
  * empty.
336
+ *
337
  * @param boolean $maybe_empty
338
  * @param array $postarr
339
  * @return boolean
360
 
361
  /**
362
  * Save capability options.
363
+ *
364
  * @param int $post_id
365
  * @param mixed $post post data (not used here)
366
  */
378
  // See http://codex.wordpress.org/Function_Reference/current_user_can 20130119 WP 3.5
379
  // "... Some capability checks (like 'edit_post' or 'delete_page') require this [the post ID] be provided."
380
  // If the post ID is not provided, it will throw:
381
+ // PHP Notice: Undefined offset: 0 in /var/www/groups-forums/wp-includes/capabilities.php on line 1067
382
  $edit_post_type = 'edit_' . $post_type;
383
  if ( $post_type_object = get_post_type_object( $post_type ) ) {
384
  if ( !isset( $post_type_object->capabilities ) ) {
678
  }
679
  return $result;
680
  }
681
+ }
682
  Groups_Access_Meta_Boxes_Legacy::init();
legacy/access/class-groups-post-access-legacy.php CHANGED
@@ -77,7 +77,7 @@ class Groups_Post_Access_Legacy {
77
 
78
  /**
79
  * Restrict access to edit or delete posts based on the post's access restrictions.
80
- *
81
  * @param array $caps
82
  * @param string $cap
83
  * @param int $user_id
@@ -107,7 +107,7 @@ class Groups_Post_Access_Legacy {
107
  if ( $cap === $edit_post_type || $cap === $delete_post_type ) {
108
  $post_id = null;
109
  if ( is_numeric( $args[0] ) ) {
110
- $post_id = $args[0];
111
  } else if ( $args[0] instanceof WP_Post ) {
112
  $post_id = $post->ID;
113
  }
@@ -125,7 +125,7 @@ class Groups_Post_Access_Legacy {
125
 
126
  /**
127
  * Filters out posts that the user should not be able to access.
128
- *
129
  * @param string $where current where conditions
130
  * @param WP_Query $query current query
131
  * @return string modified $where
@@ -187,7 +187,7 @@ class Groups_Post_Access_Legacy {
187
 
188
  /**
189
  * Filter pages by access capability.
190
- *
191
  * @param array $pages
192
  */
193
  public static function get_pages( $pages ) {
@@ -203,7 +203,7 @@ class Groups_Post_Access_Legacy {
203
 
204
  /**
205
  * Filter posts by access capability.
206
- *
207
  * @param array $posts list of posts
208
  * @param WP_Query $query
209
  */
@@ -220,7 +220,7 @@ class Groups_Post_Access_Legacy {
220
 
221
  /**
222
  * Filter menu items by access capability.
223
- *
224
  * @param array $items
225
  * @param mixed $menu
226
  * @param array $args
@@ -238,7 +238,7 @@ class Groups_Post_Access_Legacy {
238
 
239
  /**
240
  * Filter excerpt by access capability.
241
- *
242
  * @param string $output
243
  * @return $output if access granted, otherwise ''
244
  */
@@ -278,19 +278,19 @@ class Groups_Post_Access_Legacy {
278
 
279
  /**
280
  * Adds an access capability requirement.
281
- *
282
  * $map must contain 'post_id' (*)
283
- *
284
  * For now this only should be used to add the READ_POST_CAPABILITY which
285
  * it does automatically. Nothing else is checked for granting access.
286
- *
287
  * (*) Revisions : As of Groups 1.3.13 and at WordPress 3.6.1, as
288
  * add_post_meta stores postmeta for the revision's parent, we retrieve
289
  * the parent's post ID if it applies and check against that to see if
290
  * that capability is already present. This is to avoid duplicating
291
  * the already existing postmeta entry (which ocurred in previous
292
  * versions).
293
- *
294
  * @param array $map
295
  * @return true if the capability could be added to the post, otherwis false
296
  */
@@ -317,10 +317,10 @@ class Groups_Post_Access_Legacy {
317
 
318
  /**
319
  * Returns true if the post requires the given capability to grant access.
320
- *
321
  * Currently only READ_POST_CAPABILITY should be used, this is also taken
322
  * as the default.
323
- *
324
  * @param int $post_id
325
  * @param string $capability capability label
326
  * @return true if the capability is required, otherwise false
@@ -336,7 +336,7 @@ class Groups_Post_Access_Legacy {
336
 
337
  /**
338
  * Currently does nothing, always returns false.
339
- *
340
  * @param array $map
341
  * @return false
342
  */
@@ -346,7 +346,7 @@ class Groups_Post_Access_Legacy {
346
 
347
  /**
348
  * Removes a capability requirement from a post.
349
- *
350
  * @param int $post_id
351
  * @param string $capability defaults to groups_read_post, removes all if null is given
352
  * @return true on success, otherwise false
@@ -365,7 +365,7 @@ class Groups_Post_Access_Legacy {
365
 
366
  /**
367
  * Returns a list of capabilities that grant access to the post.
368
- *
369
  * @param int $post_id
370
  * @return array of string, capabilities
371
  */
@@ -375,9 +375,9 @@ class Groups_Post_Access_Legacy {
375
 
376
  /**
377
  * Returns true if the user has any of the capabilities that grant access to the post.
378
- *
379
  * @param int $post_id post id
380
- * @param int $user_id user id or null for current user
381
  * @return boolean true if user can read the post
382
  */
383
  public static function user_can_read_post( $post_id, $user_id = null ) {
@@ -413,7 +413,7 @@ class Groups_Post_Access_Legacy {
413
  /**
414
  * Hooks into groups_deleted_capability_capability to remove existing access
415
  * restrictions based on the deleted capability.
416
- *
417
  * @param string $name of the deleted capability
418
  */
419
  public static function groups_deleted_capability_capability( $capability ) {
77
 
78
  /**
79
  * Restrict access to edit or delete posts based on the post's access restrictions.
80
+ *
81
  * @param array $caps
82
  * @param string $cap
83
  * @param int $user_id
107
  if ( $cap === $edit_post_type || $cap === $delete_post_type ) {
108
  $post_id = null;
109
  if ( is_numeric( $args[0] ) ) {
110
+ $post_id = $args[0];
111
  } else if ( $args[0] instanceof WP_Post ) {
112
  $post_id = $post->ID;
113
  }
125
 
126
  /**
127
  * Filters out posts that the user should not be able to access.
128
+ *
129
  * @param string $where current where conditions
130
  * @param WP_Query $query current query
131
  * @return string modified $where
187
 
188
  /**
189
  * Filter pages by access capability.
190
+ *
191
  * @param array $pages
192
  */
193
  public static function get_pages( $pages ) {
203
 
204
  /**
205
  * Filter posts by access capability.
206
+ *
207
  * @param array $posts list of posts
208
  * @param WP_Query $query
209
  */
220
 
221
  /**
222
  * Filter menu items by access capability.
223
+ *
224
  * @param array $items
225
  * @param mixed $menu
226
  * @param array $args
238
 
239
  /**
240
  * Filter excerpt by access capability.
241
+ *
242
  * @param string $output
243
  * @return $output if access granted, otherwise ''
244
  */
278
 
279
  /**
280
  * Adds an access capability requirement.
281
+ *
282
  * $map must contain 'post_id' (*)
283
+ *
284
  * For now this only should be used to add the READ_POST_CAPABILITY which
285
  * it does automatically. Nothing else is checked for granting access.
286
+ *
287
  * (*) Revisions : As of Groups 1.3.13 and at WordPress 3.6.1, as
288
  * add_post_meta stores postmeta for the revision's parent, we retrieve
289
  * the parent's post ID if it applies and check against that to see if
290
  * that capability is already present. This is to avoid duplicating
291
  * the already existing postmeta entry (which ocurred in previous
292
  * versions).
293
+ *
294
  * @param array $map
295
  * @return true if the capability could be added to the post, otherwis false
296
  */
317
 
318
  /**
319
  * Returns true if the post requires the given capability to grant access.
320
+ *
321
  * Currently only READ_POST_CAPABILITY should be used, this is also taken
322
  * as the default.
323
+ *
324
  * @param int $post_id
325
  * @param string $capability capability label
326
  * @return true if the capability is required, otherwise false
336
 
337
  /**
338
  * Currently does nothing, always returns false.
339
+ *
340
  * @param array $map
341
  * @return false
342
  */
346
 
347
  /**
348
  * Removes a capability requirement from a post.
349
+ *
350
  * @param int $post_id
351
  * @param string $capability defaults to groups_read_post, removes all if null is given
352
  * @return true on success, otherwise false
365
 
366
  /**
367
  * Returns a list of capabilities that grant access to the post.
368
+ *
369
  * @param int $post_id
370
  * @return array of string, capabilities
371
  */
375
 
376
  /**
377
  * Returns true if the user has any of the capabilities that grant access to the post.
378
+ *
379
  * @param int $post_id post id
380
+ * @param int $user_id user id or null for current user
381
  * @return boolean true if user can read the post
382
  */
383
  public static function user_can_read_post( $post_id, $user_id = null ) {
413
  /**
414
  * Hooks into groups_deleted_capability_capability to remove existing access
415
  * restrictions based on the deleted capability.
416
+ *
417
  * @param string $name of the deleted capability
418
  */
419
  public static function groups_deleted_capability_capability( $capability ) {
legacy/admin/class-groups-admin-post-columns-legacy.php CHANGED
@@ -67,7 +67,7 @@ class Groups_Admin_Post_Columns_Legacy {
67
  /**
68
  * Adds a new column to the post type's table showing the access
69
  * restriction capabilities.
70
- *
71
  * @param array $column_headers
72
  * @return array column headers
73
  */
@@ -81,7 +81,7 @@ class Groups_Admin_Post_Columns_Legacy {
81
 
82
  /**
83
  * Renders custom column content.
84
- *
85
  * @param string $column_name
86
  * @param int $post_id
87
  * @return string custom column content
67
  /**
68
  * Adds a new column to the post type's table showing the access
69
  * restriction capabilities.
70
+ *
71
  * @param array $column_headers
72
  * @return array column headers
73
  */
81
 
82
  /**
83
  * Renders custom column content.
84
+ *
85
  * @param string $column_name
86
  * @param int $post_id
87
  * @return string custom column content
legacy/admin/class-groups-admin-posts-legacy.php CHANGED
@@ -153,7 +153,7 @@ class Groups_Admin_Posts_Legacy {
153
 
154
  /**
155
  * Bulk-edit access restriction capabilities.
156
- *
157
  * @param string $column_name
158
  * @param string $post_type
159
  */
@@ -221,7 +221,7 @@ class Groups_Admin_Posts_Legacy {
221
  * This is called once for each post that is included in bulk-editing.
222
  * The fields that are handled here are rendered through the
223
  * bulk_edit_custom_box() method in this class.
224
- *
225
  * @param int $post_id
226
  */
227
  public static function save_post( $post_id ) {
@@ -257,7 +257,7 @@ class Groups_Admin_Posts_Legacy {
257
  /**
258
  * Query modifier to take the selected access restriction capability into
259
  * account.
260
- *
261
  * @param WP_Query $query query object passed by reference
262
  */
263
  public static function parse_query( &$query ) {
153
 
154
  /**
155
  * Bulk-edit access restriction capabilities.
156
+ *
157
  * @param string $column_name
158
  * @param string $post_type
159
  */
221
  * This is called once for each post that is included in bulk-editing.
222
  * The fields that are handled here are rendered through the
223
  * bulk_edit_custom_box() method in this class.
224
+ *
225
  * @param int $post_id
226
  */
227
  public static function save_post( $post_id ) {
257
  /**
258
  * Query modifier to take the selected access restriction capability into
259
  * account.
260
+ *
261
  * @param WP_Query $query query object passed by reference
262
  */
263
  public static function parse_query( &$query ) {
lib/access/class-groups-access-shortcodes.php CHANGED
@@ -46,7 +46,7 @@ class Groups_Access_Shortcodes {
46
  * Takes one attribute "group" which is a comma-separated list of group
47
  * names or ids (can be mixed).
48
  * The content is shown if the current user belongs to the group(s).
49
- *
50
  * @param array $atts attributes
51
  * @param string $content content to render
52
  */
@@ -122,7 +122,7 @@ class Groups_Access_Shortcodes {
122
  * Takes one attribute "capability" that must be a valid capability label
123
  * or a list of capabilities separated by comma.
124
  * The content is shown if the current user has one of the capabilities.
125
- *
126
  * @param array $atts attributes
127
  * @param string $content content to render
128
  */
46
  * Takes one attribute "group" which is a comma-separated list of group
47
  * names or ids (can be mixed).
48
  * The content is shown if the current user belongs to the group(s).
49
+ *
50
  * @param array $atts attributes
51
  * @param string $content content to render
52
  */
122
  * Takes one attribute "capability" that must be a valid capability label
123
  * or a list of capabilities separated by comma.
124
  * The content is shown if the current user has one of the capabilities.
125
+ *
126
  * @param array $atts attributes
127
  * @param string $content content to render
128
  */
lib/access/class-groups-post-access.php CHANGED
@@ -44,7 +44,7 @@ class Groups_Post_Access {
44
  const CACHE_GROUP = 'groups';
45
 
46
  /**
47
- *
48
  * @var string
49
  */
50
  const CAN_READ_POST = 'can_read_post';
@@ -160,7 +160,7 @@ class Groups_Post_Access {
160
 
161
  /**
162
  * Restrict access to edit or delete posts based on the post's access restrictions.
163
- *
164
  * @param array $caps
165
  * @param string $cap
166
  * @param int $user_id
@@ -190,7 +190,7 @@ class Groups_Post_Access {
190
  if ( $cap === $edit_post_type || $cap === $delete_post_type ) {
191
  $post_id = null;
192
  if ( is_numeric( $args[0] ) ) {
193
- $post_id = $args[0];
194
  } else if ( $args[0] instanceof WP_Post ) {
195
  $post_id = $args[0]->ID;
196
  }
@@ -208,7 +208,7 @@ class Groups_Post_Access {
208
 
209
  /**
210
  * Filters out posts that the user should not be able to access.
211
- *
212
  * @param string $where current where conditions
213
  * @param WP_Query $query current query
214
  * @return string modified $where
@@ -349,7 +349,7 @@ class Groups_Post_Access {
349
 
350
  /**
351
  * Filter pages by access capability.
352
- *
353
  * @param array $pages
354
  */
355
  public static function get_pages( $pages ) {
@@ -369,7 +369,7 @@ class Groups_Post_Access {
369
 
370
  /**
371
  * Filter posts by access capability.
372
- *
373
  * @param array $posts list of posts
374
  * @param WP_Query $query
375
  */
@@ -390,9 +390,9 @@ class Groups_Post_Access {
390
 
391
  /**
392
  * Filter menu items by access capability.
393
- *
394
  * @todo admin section: this won't inhibit the items being offered to be added, although when they're added they won't show up in the menu
395
- *
396
  * @param array $items
397
  * @param mixed $menu
398
  * @param array $args
@@ -419,7 +419,7 @@ class Groups_Post_Access {
419
 
420
  /**
421
  * Filter excerpt by access capability.
422
- *
423
  * @param string $output
424
  * @return $output if access granted, otherwise ''
425
  */
@@ -510,14 +510,14 @@ class Groups_Post_Access {
510
 
511
  /**
512
  * Adds an access requirement based on post_id and group_id.
513
- *
514
  * (*) Revisions : As of Groups 1.3.13 and at WordPress 3.6.1, as
515
  * add_post_meta stores postmeta for the revision's parent, we retrieve
516
  * the parent's post ID if it applies and check against that to see if
517
  * that capability is already present. This is to avoid duplicating
518
  * the already existing postmeta entry (which ocurred in previous
519
  * versions).
520
- *
521
  * @param array $map must contain 'post_id' (*) and 'group_id'
522
  * @return true if the capability could be added to the post, otherwise false
523
  */
@@ -550,10 +550,10 @@ class Groups_Post_Access {
550
 
551
  /**
552
  * Returns true if the post requires the user to be a member of the given group(s) to grant access.
553
- *
554
  * @param int $post_id ID of the post
555
  * @param array $map should provide 'post_id' and 'groups_read'
556
- *
557
  * @return true if the group(s) is required, otherwise false
558
  */
559
  public static function read( $post_id, $map = array() ) {
@@ -582,9 +582,9 @@ class Groups_Post_Access {
582
 
583
  /**
584
  * Update the post access restrictions.
585
- *
586
  * $map must provide 'post_id' (int) indicating the post's ID and 'groups_read' (int|array of int) holding group IDs that restrict read access.
587
- *
588
  * @param array $map
589
  * @return array of group ids, false on failure
590
  */
@@ -617,7 +617,7 @@ class Groups_Post_Access {
617
 
618
  /**
619
  * Removes a access restrictions from a post.
620
- *
621
  * @param int $post_id
622
  * @param array $map must provide 'groups_read' holding group IDs to remove from restricting access to the post; if empty, all access restrictions will be removed
623
  * @return true on success, otherwise false
@@ -645,7 +645,7 @@ class Groups_Post_Access {
645
 
646
  /**
647
  * Returns a list of capabilities that grant access to the post.
648
- *
649
  * @deprecated
650
  * @param int $post_id
651
  * @return array of string, capabilities
@@ -673,9 +673,9 @@ class Groups_Post_Access {
673
 
674
  /**
675
  * Returns true if the user belongs to any of the groups that grant access to the post.
676
- *
677
  * @param int $post_id post id
678
- * @param int $user_id user id or null for current user
679
  * @return boolean true if user can read the post
680
  */
681
  public static function user_can_read_post( $post_id, $user_id = null ) {
@@ -726,7 +726,7 @@ class Groups_Post_Access {
726
  /**
727
  * Hooks into groups_deleted_group to remove existing access restrictions
728
  * based on the deleted group.
729
- *
730
  * @param int $group_id the ID of the deleted group
731
  */
732
  public static function groups_deleted_group( $group_id ) {
@@ -737,7 +737,7 @@ class Groups_Post_Access {
737
 
738
  /**
739
  * Hooked on wp_count_posts to correct the post counts.
740
- *
741
  * Note: at WP 4.7.4 through WP_Posts_List_Table::prepare_items() which obtains $post_status
742
  * independent of the post type, we will come here for any post status, so don't be surprised
743
  * to see this executed e.g. on post type 'post' with e.g. 'wc-completed' post status.
@@ -796,7 +796,7 @@ class Groups_Post_Access {
796
  /**
797
  * Would be hooked on wp_count_attachments to correct the counts but it's not actually
798
  * being used in the current media library.
799
- *
800
  * @param object $counts An object containing the attachment counts by mime type.
801
  * @param string $mime_type The mime type pattern used to filter the attachments counted.
802
  */
44
  const CACHE_GROUP = 'groups';
45
 
46
  /**
47
+ *
48
  * @var string
49
  */
50
  const CAN_READ_POST = 'can_read_post';
160
 
161
  /**
162
  * Restrict access to edit or delete posts based on the post's access restrictions.
163
+ *
164
  * @param array $caps
165
  * @param string $cap
166
  * @param int $user_id
190
  if ( $cap === $edit_post_type || $cap === $delete_post_type ) {
191
  $post_id = null;
192
  if ( is_numeric( $args[0] ) ) {
193
+ $post_id = $args[0];
194
  } else if ( $args[0] instanceof WP_Post ) {
195
  $post_id = $args[0]->ID;
196
  }
208
 
209
  /**
210
  * Filters out posts that the user should not be able to access.
211
+ *
212
  * @param string $where current where conditions
213
  * @param WP_Query $query current query
214
  * @return string modified $where
349
 
350
  /**
351
  * Filter pages by access capability.
352
+ *
353
  * @param array $pages
354
  */
355
  public static function get_pages( $pages ) {
369
 
370
  /**
371
  * Filter posts by access capability.
372
+ *
373
  * @param array $posts list of posts
374
  * @param WP_Query $query
375
  */
390
 
391
  /**
392
  * Filter menu items by access capability.
393
+ *
394
  * @todo admin section: this won't inhibit the items being offered to be added, although when they're added they won't show up in the menu
395
+ *
396
  * @param array $items
397
  * @param mixed $menu
398
  * @param array $args
419
 
420
  /**
421
  * Filter excerpt by access capability.
422
+ *
423
  * @param string $output
424
  * @return $output if access granted, otherwise ''
425
  */
510
 
511
  /**
512
  * Adds an access requirement based on post_id and group_id.
513
+ *
514
  * (*) Revisions : As of Groups 1.3.13 and at WordPress 3.6.1, as
515
  * add_post_meta stores postmeta for the revision's parent, we retrieve
516
  * the parent's post ID if it applies and check against that to see if
517
  * that capability is already present. This is to avoid duplicating
518
  * the already existing postmeta entry (which ocurred in previous
519
  * versions).
520
+ *
521
  * @param array $map must contain 'post_id' (*) and 'group_id'
522
  * @return true if the capability could be added to the post, otherwise false
523
  */
550
 
551
  /**
552
  * Returns true if the post requires the user to be a member of the given group(s) to grant access.
553
+ *
554
  * @param int $post_id ID of the post
555
  * @param array $map should provide 'post_id' and 'groups_read'
556
+ *
557
  * @return true if the group(s) is required, otherwise false
558
  */
559
  public static function read( $post_id, $map = array() ) {
582
 
583
  /**
584
  * Update the post access restrictions.
585
+ *
586
  * $map must provide 'post_id' (int) indicating the post's ID and 'groups_read' (int|array of int) holding group IDs that restrict read access.
587
+ *
588
  * @param array $map
589
  * @return array of group ids, false on failure
590
  */
617
 
618
  /**
619
  * Removes a access restrictions from a post.
620
+ *
621
  * @param int $post_id
622
  * @param array $map must provide 'groups_read' holding group IDs to remove from restricting access to the post; if empty, all access restrictions will be removed
623
  * @return true on success, otherwise false
645
 
646
  /**
647
  * Returns a list of capabilities that grant access to the post.
648
+ *
649
  * @deprecated
650
  * @param int $post_id
651
  * @return array of string, capabilities
673
 
674
  /**
675
  * Returns true if the user belongs to any of the groups that grant access to the post.
676
+ *
677
  * @param int $post_id post id
678
+ * @param int $user_id user id or null for current user
679
  * @return boolean true if user can read the post
680
  */
681
  public static function user_can_read_post( $post_id, $user_id = null ) {
726
  /**
727
  * Hooks into groups_deleted_group to remove existing access restrictions
728
  * based on the deleted group.
729
+ *
730
  * @param int $group_id the ID of the deleted group
731
  */
732
  public static function groups_deleted_group( $group_id ) {
737
 
738
  /**
739
  * Hooked on wp_count_posts to correct the post counts.
740
+ *
741
  * Note: at WP 4.7.4 through WP_Posts_List_Table::prepare_items() which obtains $post_status
742
  * independent of the post type, we will come here for any post status, so don't be surprised
743
  * to see this executed e.g. on post type 'post' with e.g. 'wc-completed' post status.
796
  /**
797
  * Would be hooked on wp_count_attachments to correct the counts but it's not actually
798
  * being used in the current media library.
799
+ *
800
  * @param object $counts An object containing the attachment counts by mime type.
801
  * @param string $mime_type The mime type pattern used to filter the attachments counted.
802
  */
lib/admin/class-groups-admin-notice.php CHANGED
@@ -30,14 +30,14 @@ class Groups_Admin_Notice {
30
 
31
  /**
32
  * Time mark.
33
- *
34
  * @var string
35
  */
36
  const INIT_TIME = 'groups-init-time';
37
 
38
  /**
39
  * Used to store user meta and hide the notice asking to review.
40
- *
41
  * @var string
42
  */
43
  const HIDE_REVIEW_NOTICE = 'groups-hide-review-notice';
@@ -51,7 +51,7 @@ class Groups_Admin_Notice {
51
 
52
  /**
53
  * The number of seconds in seven days, since init date to show the notice.
54
- *
55
  * @var int
56
  */
57
  const SHOW_LAPSE = 604800;
30
 
31
  /**
32
  * Time mark.
33
+ *
34
  * @var string
35
  */
36
  const INIT_TIME = 'groups-init-time';
37
 
38
  /**
39
  * Used to store user meta and hide the notice asking to review.
40
+ *
41
  * @var string
42
  */
43
  const HIDE_REVIEW_NOTICE = 'groups-hide-review-notice';
51
 
52
  /**
53
  * The number of seconds in seven days, since init date to show the notice.
54
+ *
55
  * @var int
56
  */
57
  const SHOW_LAPSE = 604800;
lib/admin/class-groups-admin-post-columns.php CHANGED
@@ -85,7 +85,7 @@ class Groups_Admin_Post_Columns {
85
  /**
86
  * Adds a new column to the post type's table showing the access
87
  * restriction groups.
88
- *
89
  * @param array $column_headers
90
  * @return array column headers
91
  */
@@ -100,7 +100,7 @@ class Groups_Admin_Post_Columns {
100
 
101
  /**
102
  * Renders custom column content.
103
- *
104
  * @param string $column_name
105
  * @param int $post_id
106
  * @return string custom column content
@@ -204,10 +204,10 @@ class Groups_Admin_Post_Columns {
204
 
205
  /**
206
  * Groups column is sortable.
207
- *
208
  * Sorting depends on the filters Groups_Admin_Posts::posts_join() and Groups_Admin_Posts::posts_orderby()
209
  * which add the relevant group information and sort by group name.
210
- *
211
  * @see Groups_Admin_Posts::posts_join()
212
  * @see Groups_Admin_Posts::posts_orderby()
213
  * @param array $sortable_columns
85
  /**
86
  * Adds a new column to the post type's table showing the access
87
  * restriction groups.
88
+ *
89
  * @param array $column_headers
90
  * @return array column headers
91
  */
100
 
101
  /**
102
  * Renders custom column content.
103
+ *
104
  * @param string $column_name
105
  * @param int $post_id
106
  * @return string custom column content
204
 
205
  /**
206
  * Groups column is sortable.
207
+ *
208
  * Sorting depends on the filters Groups_Admin_Posts::posts_join() and Groups_Admin_Posts::posts_orderby()
209
  * which add the relevant group information and sort by group name.
210
+ *
211
  * @see Groups_Admin_Posts::posts_join()
212
  * @see Groups_Admin_Posts::posts_orderby()
213
  * @param array $sortable_columns
lib/admin/class-groups-admin-posts.php CHANGED
@@ -193,7 +193,7 @@ class Groups_Admin_Posts {
193
 
194
  /**
195
  * Bulk-edit access restriction groups.
196
- *
197
  * @param string $column_name
198
  * @param string $post_type
199
  */
@@ -267,7 +267,7 @@ class Groups_Admin_Posts {
267
  * This is called once for each post that is included in bulk-editing.
268
  * The fields that are handled here are rendered through the
269
  * bulk_edit_custom_box() method in this class.
270
- *
271
  * @param int $post_id
272
  */
273
  public static function save_post( $post_id ) {
@@ -394,7 +394,7 @@ class Groups_Admin_Posts {
394
  /**
395
  * Filters out posts by group. This is used when you choose groups on the post admin screen so that
396
  * only those posts who are restricted by groups are shown.
397
- *
398
  * @param string $where
399
  * @param WP_Query $query
400
  * @return string
193
 
194
  /**
195
  * Bulk-edit access restriction groups.
196
+ *
197
  * @param string $column_name
198
  * @param string $post_type
199
  */
267
  * This is called once for each post that is included in bulk-editing.
268
  * The fields that are handled here are rendered through the
269
  * bulk_edit_custom_box() method in this class.
270
+ *
271
  * @param int $post_id
272
  */
273
  public static function save_post( $post_id ) {
394
  /**
395
  * Filters out posts by group. This is used when you choose groups on the post admin screen so that
396
  * only those posts who are restricted by groups are shown.
397
+ *
398
  * @param string $where
399
  * @param WP_Query $query
400
  * @return string
lib/admin/class-groups-admin-user-profile.php CHANGED
@@ -60,9 +60,9 @@ class Groups_Admin_User_Profile {
60
 
61
  /**
62
  * Hook for the form to create a new user.
63
- *
64
  * See wp-admin/user-new.php
65
- *
66
  * @param string $type form context, expecting 'add-existing-user' (Multisite), or 'add-new-user' (single site and network admin)
67
  */
68
  public static function user_new_form( $type = null ) {
@@ -99,7 +99,7 @@ class Groups_Admin_User_Profile {
99
  /**
100
  * Adds the new user to chosen groups when creating a new user account
101
  * from the admin side.
102
- *
103
  * @param int $user_id
104
  */
105
  public static function user_register( $user_id ) {
@@ -196,13 +196,13 @@ class Groups_Admin_User_Profile {
196
  /**
197
  * Updates the group membership when a user's own profile is saved - but
198
  * for group admins on their own profile page only.
199
- *
200
  * @param int $user_id
201
  * @see Groups_Admin_User_Profile::edit_user_profile_update()
202
  */
203
  public static function personal_options_update( $user_id ) {
204
  // We're using the same method as for editing another user's profile,
205
- // but let's check for group admin here as well.
206
  if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
207
  self::edit_user_profile_update( $user_id );
208
  }
60
 
61
  /**
62
  * Hook for the form to create a new user.
63
+ *
64
  * See wp-admin/user-new.php
65
+ *
66
  * @param string $type form context, expecting 'add-existing-user' (Multisite), or 'add-new-user' (single site and network admin)
67
  */
68
  public static function user_new_form( $type = null ) {
99
  /**
100
  * Adds the new user to chosen groups when creating a new user account
101
  * from the admin side.
102
+ *
103
  * @param int $user_id
104
  */
105
  public static function user_register( $user_id ) {
196
  /**
197
  * Updates the group membership when a user's own profile is saved - but
198
  * for group admins on their own profile page only.
199
+ *
200
  * @param int $user_id
201
  * @see Groups_Admin_User_Profile::edit_user_profile_update()
202
  */
203
  public static function personal_options_update( $user_id ) {
204
  // We're using the same method as for editing another user's profile,
205
+ // but let's check for group admin here as well.
206
  if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
207
  self::edit_user_profile_update( $user_id );
208
  }
lib/admin/class-groups-admin-users.php CHANGED
@@ -63,7 +63,7 @@ class Groups_Admin_Users {
63
  add_filter( 'pre_user_query', array( __CLASS__, 'pre_user_query' ) );
64
  // WP_Users_List_Table implements extra_tablenav() where the restrict_manage_users action is invoked.
65
  // As the extra_tablenav() method does not define a generic extension point, this is
66
- // the best shot we get at inserting our group actions block (currently we're at WordPress 3.6.1).
67
  // We choose to use our own group-actions block instead of re-using the existing bulk-actions,
68
  // to have a more explicit user interface which makes it clear that these actions
69
  // are directed at relating users and groups.
@@ -74,7 +74,7 @@ class Groups_Admin_Users {
74
 
75
  /**
76
  * Modify query to filter users by group.
77
- *
78
  * @param WP_User_Query $user_query
79
  * @return WP_User_Query
80
  */
@@ -353,7 +353,7 @@ class Groups_Admin_Users {
353
  /**
354
  * Adds a new column to the users table to show the groups that users
355
  * belong to.
356
- *
357
  * @param array $column_headers
358
  * @return array column headers
359
  */
@@ -364,8 +364,8 @@ class Groups_Admin_Users {
364
 
365
  /**
366
  * Renders custom column content.
367
- *
368
- * @param string $output
369
  * @param string $column_name
370
  * @param int $user_id
371
  * @return string custom column content
63
  add_filter( 'pre_user_query', array( __CLASS__, 'pre_user_query' ) );
64
  // WP_Users_List_Table implements extra_tablenav() where the restrict_manage_users action is invoked.
65
  // As the extra_tablenav() method does not define a generic extension point, this is
66
+ // the best shot we get at inserting our group actions block (currently we're at WordPress 3.6.1).
67
  // We choose to use our own group-actions block instead of re-using the existing bulk-actions,
68
  // to have a more explicit user interface which makes it clear that these actions
69
  // are directed at relating users and groups.
74
 
75
  /**
76
  * Modify query to filter users by group.
77
+ *
78
  * @param WP_User_Query $user_query
79
  * @return WP_User_Query
80
  */
353
  /**
354
  * Adds a new column to the users table to show the groups that users
355
  * belong to.
356
+ *
357
  * @param array $column_headers
358
  * @return array column headers
359
  */
364
 
365
  /**
366
  * Renders custom column content.
367
+ *
368
+ * @param string $output
369
  * @param string $column_name
370
  * @param int $user_id
371
  * @return string custom column content
lib/admin/class-groups-admin.php CHANGED
@@ -30,7 +30,7 @@ class Groups_Admin {
30
 
31
  /**
32
  * The position of the Groups menu.
33
- *
34
  * @var int
35
  */
36
  const MENU_POSITION = '38.381';
@@ -68,7 +68,7 @@ class Groups_Admin {
68
 
69
  /**
70
  * Loads styles for the Groups admin section.
71
- *
72
  * @see Groups_Admin::admin_menu()
73
  */
74
  public static function admin_print_styles() {
@@ -90,7 +90,7 @@ class Groups_Admin {
90
  * The message is filtered using wp_filter_kses() and wrapped in a div
91
  * with class 'updated' for messages of type 'info' and 'error' for
92
  * those of type 'error'.
93
- *
94
  * @param string $message the message
95
  * @param string $type type of message, defaults to 'info'
96
  * @uses wp_filter_kses()
@@ -107,7 +107,7 @@ class Groups_Admin {
107
  /**
108
  * Returns the list of messages as a string.
109
  * An empty string is returned if there are no messages.
110
- *
111
  * @return string
112
  */
113
  public static function render_messages() {
30
 
31
  /**
32
  * The position of the Groups menu.
33
+ *
34
  * @var int
35
  */
36
  const MENU_POSITION = '38.381';
68
 
69
  /**
70
  * Loads styles for the Groups admin section.
71
+ *
72
  * @see Groups_Admin::admin_menu()
73
  */
74
  public static function admin_print_styles() {
90
  * The message is filtered using wp_filter_kses() and wrapped in a div
91
  * with class 'updated' for messages of type 'info' and 'error' for
92
  * those of type 'error'.
93
+ *
94
  * @param string $message the message
95
  * @param string $type type of message, defaults to 'info'
96
  * @uses wp_filter_kses()
107
  /**
108
  * Returns the list of messages as a string.
109
  * An empty string is returned if there are no messages.
110
+ *
111
  * @return string
112
  */
113
  public static function render_messages() {
lib/admin/groups-admin-add-ons.php CHANGED
@@ -37,7 +37,7 @@ function groups_admin_add_ons() {
37
 
38
  /**
39
  * Renders the content of the Add-Ons section.
40
- *
41
  * @param $params array of options (offset is 0 by default and used to adjust heading h2)
42
  */
43
  function groups_admin_add_ons_content( $params = array( 'offset' => 0 ) ) {
@@ -92,13 +92,6 @@ function groups_admin_add_ons_content( $params = array( 'offset' => 0 ) ) {
92
  'url' => 'https://www.itthinx.com/shop/groups-newsletters/',
93
  'index' => 100
94
  ),
95
- 'groups-paypal' => array(
96
- 'title' => 'Groups PayPal',
97
- 'content' => 'Sell memberships and subscriptions with Groups and PayPal.',
98
- 'image' => GROUPS_PLUGIN_URL . 'images/add-ons/groups-paypal.png',
99
- 'url' => 'https://www.itthinx.com/shop/groups-paypal/',
100
- 'index' => 100
101
- ),
102
  'groups-restrict-categories' => array(
103
  'title' => 'Groups Restrict Categories',
104
  'content' => 'Access restrictions for categories and tags, also supporting custom post types and taxonomies.',
37
 
38
  /**
39
  * Renders the content of the Add-Ons section.
40
+ *
41
  * @param $params array of options (offset is 0 by default and used to adjust heading h2)
42
  */
43
  function groups_admin_add_ons_content( $params = array( 'offset' => 0 ) ) {
92
  'url' => 'https://www.itthinx.com/shop/groups-newsletters/',
93
  'index' => 100
94
  ),
 
 
 
 
 
 
 
95
  'groups-restrict-categories' => array(
96
  'title' => 'Groups Restrict Categories',
97
  'content' => 'Access restrictions for categories and tags, also supporting custom post types and taxonomies.',
lib/auto/class-groups-registered.php CHANGED
@@ -66,7 +66,7 @@ class Groups_Registered {
66
 
67
  // For translation of the "Registered" group(s)
68
  __( 'Registered', 'groups' );
69
-
70
  // When a blog is added, create a new "Registered" group for that blog.
71
  add_action( 'wpmu_new_blog', array( __CLASS__, 'wpmu_new_blog' ), 10, 2 );
72
 
@@ -86,9 +86,9 @@ class Groups_Registered {
86
 
87
  /**
88
  * Create "Registered" group for new blog and add its admin user.
89
- *
90
  * @see Groups_Controller::wpmu_new_blog()
91
- *
92
  * @param int $blog_id
93
  * @param int $user_id blog's admin user's id
94
  * @param string $domain (optional)
@@ -118,7 +118,7 @@ class Groups_Registered {
118
 
119
  /**
120
  * Assign a newly created user to its "Registered" group.
121
- *
122
  * @param int $user_id
123
  */
124
  public static function user_register( $user_id ) {
66
 
67
  // For translation of the "Registered" group(s)
68
  __( 'Registered', 'groups' );
69
+
70
  // When a blog is added, create a new "Registered" group for that blog.
71
  add_action( 'wpmu_new_blog', array( __CLASS__, 'wpmu_new_blog' ), 10, 2 );
72
 
86
 
87
  /**
88
  * Create "Registered" group for new blog and add its admin user.
89
+ *
90
  * @see Groups_Controller::wpmu_new_blog()
91
+ *
92
  * @param int $blog_id
93
  * @param int $user_id blog's admin user's id
94
  * @param string $domain (optional)
118
 
119
  /**
120
  * Assign a newly created user to its "Registered" group.
121
+ *
122
  * @param int $user_id
123
  */
124
  public static function user_register( $user_id ) {
lib/core/class-groups-cache-object.php CHANGED
@@ -25,7 +25,7 @@ if ( !defined( 'ABSPATH' ) ) {
25
 
26
  /**
27
  * Cache entry encapsulation.
28
- *
29
  * @property string $key
30
  * @property mixed $value
31
  */
@@ -45,7 +45,7 @@ class Groups_Cache_Object {
45
 
46
  /**
47
  * Create a cache entry object that holds a value for the given key.
48
- *
49
  * @param string $key
50
  * @param mixed $value
51
  */
@@ -56,7 +56,7 @@ class Groups_Cache_Object {
56
 
57
  /**
58
  * Getter implementation for key and value properties.
59
- *
60
  * @param string $name
61
  *
62
  * @return mixed property value or null
@@ -74,7 +74,7 @@ class Groups_Cache_Object {
74
 
75
  /**
76
  * Setter for key and value properties.
77
- *
78
  * @param string $name
79
  * @param mixed $value
80
  */
25
 
26
  /**
27
  * Cache entry encapsulation.
28
+ *
29
  * @property string $key
30
  * @property mixed $value
31
  */
45
 
46
  /**
47
  * Create a cache entry object that holds a value for the given key.
48
+ *
49
  * @param string $key
50
  * @param mixed $value
51
  */
56
 
57
  /**
58
  * Getter implementation for key and value properties.
59
+ *
60
  * @param string $name
61
  *
62
  * @return mixed property value or null
74
 
75
  /**
76
  * Setter for key and value properties.
77
+ *
78
  * @param string $name
79
  * @param mixed $value
80
  */
lib/core/class-groups-cache.php CHANGED
@@ -25,9 +25,9 @@ if ( !defined( 'ABSPATH' ) ) {
25
 
26
  /**
27
  * Cache service.
28
- *
29
  * Uses cache objects to encapsulate cached data.
30
- *
31
  * This makes us completely independent from the problems related to
32
  * incomplete cache implementations that ignore the $found parameter used
33
  * to disambiguate cache misses with wp_cache_get() when false is retrieved.
@@ -42,7 +42,7 @@ class Groups_Cache {
42
 
43
  /**
44
  * Retrieve an entry from cache.
45
- *
46
  * @param string $key
47
  * @param string $group
48
  * @return Groups_Cache_Object|null returns a cache object on hit, null on cache miss
@@ -58,7 +58,7 @@ class Groups_Cache {
58
 
59
  /**
60
  * Store an entry in cache.
61
- *
62
  * @param string $key
63
  * @param string $value
64
  * @param string $group
@@ -71,7 +71,7 @@ class Groups_Cache {
71
 
72
  /**
73
  * Delete a cache entry.
74
- *
75
  * @param string $key
76
  * @param string $group
77
  * @return true if successful, otherwise false
25
 
26
  /**
27
  * Cache service.
28
+ *
29
  * Uses cache objects to encapsulate cached data.
30
+ *
31
  * This makes us completely independent from the problems related to
32
  * incomplete cache implementations that ignore the $found parameter used
33
  * to disambiguate cache misses with wp_cache_get() when false is retrieved.
42
 
43
  /**
44
  * Retrieve an entry from cache.
45
+ *
46
  * @param string $key
47
  * @param string $group
48
  * @return Groups_Cache_Object|null returns a cache object on hit, null on cache miss
58
 
59
  /**
60
  * Store an entry in cache.
61
+ *
62
  * @param string $key
63
  * @param string $value
64
  * @param string $group
71
 
72
  /**
73
  * Delete a cache entry.
74
+ *
75
  * @param string $key
76
  * @param string $group
77
  * @return true if successful, otherwise false
lib/core/class-groups-capability.php CHANGED
@@ -48,7 +48,7 @@ class Groups_Capability {
48
 
49
  /**
50
  * Retrieve a property by name.
51
- *
52
  * Possible properties:
53
  * - capability_id
54
  * - capability
@@ -56,9 +56,9 @@ class Groups_Capability {
56
  * - object
57
  * - name
58
  * - description
59
- *
60
  * - group_ids groups that have the capability
61
- *
62
  * @param string $name property's name
63
  * @return mixed property value, will return null if property does not exist
64
  */
@@ -110,15 +110,15 @@ class Groups_Capability {
110
 
111
  /**
112
  * Persist a capability.
113
- *
114
  * Possible keys in $map:
115
- *
116
  * - "capability" (required) - unique capability label, max 20 characters
117
  * - "class" (optional) - class the capability applies to, max 100 chars
118
  * - "object" (optional) - identifies object of that class, max 100 chars
119
  * - "name" (optional) - name it if you have to
120
  * - "description" (optional) - dito
121
- *
122
  * @param array $map attributes, requires at least: "capability"
123
  *
124
  * @return int capability_id on success, otherwise false
@@ -169,9 +169,9 @@ class Groups_Capability {
169
 
170
  /**
171
  * Retrieve a capability.
172
- *
173
  * Use Groups_Capability::read_capability() if you are trying to retrieve a capability by its unique label.
174
- *
175
  * @see Groups_Capability::read_by_capability()
176
  * @param int $capability_id capability's id
177
  * @return object upon success, otherwise false
@@ -199,7 +199,7 @@ class Groups_Capability {
199
 
200
  /**
201
  * Retrieve a capability by its unique label.
202
- *
203
  * @param string $capability capability's unique label
204
  * @return object upon success, otherwise false
205
  */
@@ -227,7 +227,7 @@ class Groups_Capability {
227
 
228
  /**
229
  * Update capability.
230
- *
231
  * @param array $map capability attribute, must contain capability_id
232
  *
233
  * @return int capability_id on success, otherwise false
@@ -285,7 +285,7 @@ class Groups_Capability {
285
 
286
  /**
287
  * Remove capability and its relations.
288
- *
289
  * @param int $capability_id
290
  *
291
  * @return int capability_id if successful, false otherwise
48
 
49
  /**
50
  * Retrieve a property by name.
51
+ *
52
  * Possible properties:
53
  * - capability_id
54
  * - capability
56
  * - object
57
  * - name
58
  * - description
59
+ *
60
  * - group_ids groups that have the capability
61
+ *
62
  * @param string $name property's name
63
  * @return mixed property value, will return null if property does not exist
64
  */
110
 
111
  /**
112
  * Persist a capability.
113
+ *
114
  * Possible keys in $map:
115
+ *
116
  * - "capability" (required) - unique capability label, max 20 characters
117
  * - "class" (optional) - class the capability applies to, max 100 chars
118
  * - "object" (optional) - identifies object of that class, max 100 chars
119
  * - "name" (optional) - name it if you have to
120
  * - "description" (optional) - dito
121
+ *
122
  * @param array $map attributes, requires at least: "capability"
123
  *
124
  * @return int capability_id on success, otherwise false
169
 
170
  /**
171
  * Retrieve a capability.
172
+ *
173
  * Use Groups_Capability::read_capability() if you are trying to retrieve a capability by its unique label.
174
+ *
175
  * @see Groups_Capability::read_by_capability()
176
  * @param int $capability_id capability's id
177
  * @return object upon success, otherwise false
199
 
200
  /**
201
  * Retrieve a capability by its unique label.
202
+ *
203
  * @param string $capability capability's unique label
204
  * @return object upon success, otherwise false
205
  */
227
 
228
  /**
229
  * Update capability.
230
+ *
231
  * @param array $map capability attribute, must contain capability_id
232
  *
233
  * @return int capability_id on success, otherwise false
285
 
286
  /**
287
  * Remove capability and its relations.
288
+ *
289
  * @param int $capability_id
290
  *
291
  * @return int capability_id if successful, false otherwise
lib/core/class-groups-controller.php CHANGED
@@ -90,7 +90,7 @@ class Groups_Controller {
90
 
91
  /**
92
  * Run activation for a newly created blog in a multisite environment.
93
- *
94
  * @param int $blog_id
95
  */
96
  public static function wpmu_new_blog( $blog_id, $user_id ) {
@@ -107,7 +107,7 @@ class Groups_Controller {
107
  /**
108
  * Run deactivation for a blog that is about to be deleted in a multisite
109
  * environment.
110
- *
111
  * @param int $blog_id
112
  */
113
  public static function delete_blog( $blog_id, $drop = false ) {
@@ -163,7 +163,7 @@ class Groups_Controller {
163
 
164
  /**
165
  * Makes sure that our own translation file is loaded first.
166
- *
167
  * @param string $mofile
168
  * @param string $domain
169
  * @return string mofile
90
 
91
  /**
92
  * Run activation for a newly created blog in a multisite environment.
93
+ *
94
  * @param int $blog_id
95
  */
96
  public static function wpmu_new_blog( $blog_id, $user_id ) {
107
  /**
108
  * Run deactivation for a blog that is about to be deleted in a multisite
109
  * environment.
110
+ *
111
  * @param int $blog_id
112
  */
113
  public static function delete_blog( $blog_id, $drop = false ) {
163
 
164
  /**
165
  * Makes sure that our own translation file is loaded first.
166
+ *
167
  * @param string $mofile
168
  * @param string $domain
169
  * @return string mofile
lib/core/class-groups-group-capability.php CHANGED
@@ -31,7 +31,7 @@ class Groups_Group_Capability {
31
  /**
32
  * Hook into appropriate actions when needed.
33
  * For now, this does nothing.
34
- *
35
  * @see Groups_Group::delete()
36
  */
37
  public static function init() {
@@ -40,7 +40,7 @@ class Groups_Group_Capability {
40
 
41
  /**
42
  * Persist a group-capability relation.
43
- *
44
  * @param array $map attributes - must provide group_id and capability_id
45
  * @return true on success, otherwise false
46
  */
@@ -79,7 +79,7 @@ class Groups_Group_Capability {
79
 
80
  /**
81
  * Retrieve a group-capability relation.
82
- *
83
  * @param int $group_id group's id
84
  * @param int $capability_id capability's id
85
  * @return object upon success, otherwise false
@@ -102,9 +102,9 @@ class Groups_Group_Capability {
102
 
103
  /**
104
  * Update group-capability relation.
105
- *
106
  * This changes nothing so as of now it's pointless to even call this.
107
- *
108
  * @param array $map
109
  * @return true if successful, false otherwise
110
  */
@@ -122,7 +122,7 @@ class Groups_Group_Capability {
122
 
123
  /**
124
  * Remove group-capability relation.
125
- *
126
  * @param int $group_id
127
  * @param int $capability_id
128
  * @return true if successful, false otherwise
31
  /**
32
  * Hook into appropriate actions when needed.
33
  * For now, this does nothing.
34
+ *
35
  * @see Groups_Group::delete()
36
  */
37
  public static function init() {
40
 
41
  /**
42
  * Persist a group-capability relation.
43
+ *
44
  * @param array $map attributes - must provide group_id and capability_id
45
  * @return true on success, otherwise false
46
  */
79
 
80
  /**
81
  * Retrieve a group-capability relation.
82
+ *
83
  * @param int $group_id group's id
84
  * @param int $capability_id capability's id
85
  * @return object upon success, otherwise false
102
 
103
  /**
104
  * Update group-capability relation.
105
+ *
106
  * This changes nothing so as of now it's pointless to even call this.
107
+ *
108
  * @param array $map
109
  * @return true if successful, false otherwise
110
  */
122
 
123
  /**
124
  * Remove group-capability relation.
125
+ *
126
  * @param int $group_id
127
  * @param int $capability_id
128
  * @return true if successful, false otherwise
lib/core/class-groups-group.php CHANGED
@@ -183,7 +183,7 @@ class Groups_Group implements I_Capable {
183
  $capability_table = _groups_get_tablename( 'capability' );
184
  $group_capability_table = _groups_get_tablename( 'group_capability' );
185
 
186
- // determine capability id
187
  $capability_id = null;
188
  if ( is_numeric( $capability ) ) {
189
  $capability_id = Groups_Utility::id( $capability );
@@ -240,14 +240,14 @@ class Groups_Group implements I_Capable {
240
 
241
  /**
242
  * Persist a group.
243
- *
244
  * Parameters:
245
  * - name (required) - the group's name
246
  * - creator_id (optional) - defaults to the current user's id
247
  * - datetime (optional) - defaults to now
248
  * - description (optional)
249
  * - parent_id (optional)
250
- *
251
  * @param array $map attributes
252
  *
253
  * @return int group_id on success, otherwise false
@@ -283,16 +283,27 @@ class Groups_Group implements I_Capable {
283
  $formats[] = '%s';
284
  }
285
  if ( !empty( $parent_id ) ) {
286
- // only allow to set an existing parent group (that is from the same blog)
287
- $parent_group_id = $wpdb->get_var( $wpdb->prepare(
288
- "SELECT group_id FROM $group_table WHERE group_id = %d",
289
- Groups_Utility::id( $parent_id )
290
- ) );
291
- if ( $parent_group_id === $parent_id ) {
292
- $data['parent_id'] = Groups_Utility::id( $parent_id );
293
- $formats[] = '%d';
294
- } else {
295
- $error = true;
 
 
 
 
 
 
 
 
 
 
 
296
  }
297
  }
298
  // no duplicate names
@@ -315,7 +326,7 @@ class Groups_Group implements I_Capable {
315
 
316
  /**
317
  * Retrieve a group.
318
- *
319
  * @param int $group_id group's id
320
  * @return object upon success, otherwise false
321
  */
@@ -369,7 +380,7 @@ class Groups_Group implements I_Capable {
369
 
370
  /**
371
  * Update group.
372
- *
373
  * @param array $map group attribute, must contain group_id
374
  *
375
  * @return int group_id on success, otherwise false
@@ -398,22 +409,21 @@ class Groups_Group implements I_Capable {
398
  Groups_Utility::id( $group_id )
399
  ) );
400
  } else {
401
-
402
  // Prohibit circular dependencies:
403
  // This group cannot have a parent that is its successor
404
  // at any level in its successor hierarchy.
405
  // S(g) : successor of group g
406
  // S*(g) : successors of group g, any level deep
407
  // P(g) : parent of g
408
- // ---
409
  // It must hold: !( P(g) in S*(g) )
410
 
411
  // Find all successors of this group
412
  $groups = $wpdb->get_var( "SELECT COUNT(*) FROM $group_table" );
413
  if ( $groups !== null ) {
414
- $group_ids = array();
415
- $group_ids[] = Groups_Utility::id( $group_id );
416
- $iterations = 0;
417
  $old_group_ids_count = 0;
418
  while( ( $iterations < $groups ) && ( count( $group_ids ) > 0 ) && ( count( $group_ids ) !== $old_group_ids_count ) ) {
419
 
@@ -462,7 +472,7 @@ class Groups_Group implements I_Capable {
462
 
463
  /**
464
  * Remove group and its relations.
465
- *
466
  * @param int $group_id
467
  *
468
  * @return int group_id if successful, false otherwise
@@ -515,7 +525,7 @@ class Groups_Group implements I_Capable {
515
 
516
  /**
517
  * Returns an array of group IDs.
518
- *
519
  * If no arguments are passed, IDs for all existing groups are returned.
520
  *
521
  * @param array $args
@@ -545,7 +555,7 @@ class Groups_Group implements I_Capable {
545
 
546
  /**
547
  * Returns an array of database results by querying the group table.
548
- *
549
  * @param Array $args
550
  * - ['fields'] string with fields to get separated by comma. If empty then get all fields.
551
  * - ['order_by'] string a Groups_Group property
@@ -555,9 +565,9 @@ class Groups_Group implements I_Capable {
555
  * - ['include_by_name'] array|string with one ore more group names of groups to include, separated by comma
556
  * - ['exclude'] array|string with one or more IDs of groups to exclude, separated by comma
557
  * - ['exclude_by_name'] array|string with one ore more group names of groups to exclude, separated by comma
558
- *
559
  * @return array of object with query rows
560
- *
561
  * @since groups 1.4.9
562
  */
563
  public static function get_groups( $args = array() ) {
@@ -710,7 +720,7 @@ class Groups_Group implements I_Capable {
710
  $exclude_by_name = "'" . implode( "','", array_map( 'esc_sql', array_map( 'trim', $exclude_by_name ) ) ) . "'";
711
  if ( strlen( $exclude_by_name ) > 0 ) {
712
  if ( empty( $where ) ) {
713
- $where = " WHERE name NOT IN ($exclude_by_name) ";
714
  } else {
715
  $where .= " AND name NOT IN ($exclude_by_name) ";
716
  }
183
  $capability_table = _groups_get_tablename( 'capability' );
184
  $group_capability_table = _groups_get_tablename( 'group_capability' );
185
 
186
+ // determine capability id
187
  $capability_id = null;
188
  if ( is_numeric( $capability ) ) {
189
  $capability_id = Groups_Utility::id( $capability );
240
 
241
  /**
242
  * Persist a group.
243
+ *
244
  * Parameters:
245
  * - name (required) - the group's name
246
  * - creator_id (optional) - defaults to the current user's id
247
  * - datetime (optional) - defaults to now
248
  * - description (optional)
249
  * - parent_id (optional)
250
+ *
251
  * @param array $map attributes
252
  *
253
  * @return int group_id on success, otherwise false
283
  $formats[] = '%s';
284
  }
285
  if ( !empty( $parent_id ) ) {
286
+ $parent_id = Groups_Utility::id( $parent_id );
287
+ if ( $parent_id !== false ) {
288
+ // only allow to set an existing parent group (that is from the same blog)
289
+ $parent_group_id = $wpdb->get_var(
290
+ $wpdb->prepare(
291
+ "SELECT group_id FROM $group_table WHERE group_id = %d",
292
+ Groups_Utility::id( $parent_id )
293
+ )
294
+ );
295
+ if ( $parent_group_id !== null ) {
296
+ $parent_group_id = intval( $parent_group_id );
297
+ }
298
+ if (
299
+ $parent_group_id !== null &&
300
+ $parent_group_id === $parent_id
301
+ ) {
302
+ $data['parent_id'] = $parent_id;
303
+ $formats[] = '%d';
304
+ } else {
305
+ $error = true;
306
+ }
307
  }
308
  }
309
  // no duplicate names
326
 
327
  /**
328
  * Retrieve a group.
329
+ *
330
  * @param int $group_id group's id
331
  * @return object upon success, otherwise false
332
  */
380
 
381
  /**
382
  * Update group.
383
+ *
384
  * @param array $map group attribute, must contain group_id
385
  *
386
  * @return int group_id on success, otherwise false
409
  Groups_Utility::id( $group_id )
410
  ) );
411
  } else {
 
412
  // Prohibit circular dependencies:
413
  // This group cannot have a parent that is its successor
414
  // at any level in its successor hierarchy.
415
  // S(g) : successor of group g
416
  // S*(g) : successors of group g, any level deep
417
  // P(g) : parent of g
418
+ // ---
419
  // It must hold: !( P(g) in S*(g) )
420
 
421
  // Find all successors of this group
422
  $groups = $wpdb->get_var( "SELECT COUNT(*) FROM $group_table" );
423
  if ( $groups !== null ) {
424
+ $group_ids = array();
425
+ $group_ids[] = Groups_Utility::id( $group_id );
426
+ $iterations = 0;
427
  $old_group_ids_count = 0;
428
  while( ( $iterations < $groups ) && ( count( $group_ids ) > 0 ) && ( count( $group_ids ) !== $old_group_ids_count ) ) {
429
 
472
 
473
  /**
474
  * Remove group and its relations.
475
+ *
476
  * @param int $group_id
477
  *
478
  * @return int group_id if successful, false otherwise
525
 
526
  /**
527
  * Returns an array of group IDs.
528
+ *
529
  * If no arguments are passed, IDs for all existing groups are returned.
530
  *
531
  * @param array $args
555
 
556
  /**
557
  * Returns an array of database results by querying the group table.
558
+ *
559
  * @param Array $args
560
  * - ['fields'] string with fields to get separated by comma. If empty then get all fields.
561
  * - ['order_by'] string a Groups_Group property
565
  * - ['include_by_name'] array|string with one ore more group names of groups to include, separated by comma
566
  * - ['exclude'] array|string with one or more IDs of groups to exclude, separated by comma
567
  * - ['exclude_by_name'] array|string with one ore more group names of groups to exclude, separated by comma
568
+ *
569
  * @return array of object with query rows
570
+ *
571
  * @since groups 1.4.9
572
  */
573
  public static function get_groups( $args = array() ) {
720
  $exclude_by_name = "'" . implode( "','", array_map( 'esc_sql', array_map( 'trim', $exclude_by_name ) ) ) . "'";
721
  if ( strlen( $exclude_by_name ) > 0 ) {
722
  if ( empty( $where ) ) {
723
+ $where = " WHERE name NOT IN ($exclude_by_name) ";
724
  } else {
725
  $where .= " AND name NOT IN ($exclude_by_name) ";
726
  }
lib/core/class-groups-options.php CHANGED
@@ -1,19 +1,19 @@
1
  <?php
2
  /**
3
  * class-groups-options.php
4
- *
5
  * Copyright (c) "kento" Karim Rahimpur www.itthinx.com
6
- *
7
  * This code is released under the GNU General Public License.
8
  * See COPYRIGHT.txt and LICENSE.txt.
9
- *
10
  * This code is distributed in the hope that it will be useful,
11
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
  * GNU General Public License for more details.
14
- *
15
  * This header and all notices must be kept intact.
16
- *
17
  * @author Karim Rahimpur
18
  * @package groups
19
  * @since groups 1.0.0
@@ -30,36 +30,18 @@ class Groups_Options {
30
 
31
  /**
32
  * Groups plugin option key.
33
- *
34
  * @var string
35
  */
36
- const option_key = 'groups_options';
37
 
38
  /**
39
  * General option index.
40
- *
41
  * @var string
42
  */
43
  const general = 'general';
44
 
45
- /**
46
- * No instances are needed.
47
- */
48
- private function __construct() {
49
- }
50
-
51
- /**
52
- * No cloning.
53
- */
54
- private function __clone() {
55
- }
56
-
57
- /**
58
- * Would be pointless.
59
- */
60
- private function __wakeup() {
61
- }
62
-
63
  /**
64
  * Registers Groups options (not autoloaded).
65
  */
@@ -105,7 +87,7 @@ class Groups_Options {
105
 
106
  /**
107
  * Returns the value of a user setting.
108
- *
109
  * @param string $option the option id
110
  * @param mixed $default default value to retrieve if option is not set
111
  * @param int $user_id retrieve option for this user, defaults to null for current user
@@ -180,7 +162,7 @@ class Groups_Options {
180
 
181
  /**
182
  * Deletes a user setting.
183
- *
184
  * @param string $option the option's id
185
  * @param int $user_id delete option for this user, defaults to null for current user
186
  */
1
  <?php
2
  /**
3
  * class-groups-options.php
4
+ *
5
  * Copyright (c) "kento" Karim Rahimpur www.itthinx.com
6
+ *
7
  * This code is released under the GNU General Public License.
8
  * See COPYRIGHT.txt and LICENSE.txt.
9
+ *
10
  * This code is distributed in the hope that it will be useful,
11
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
  * GNU General Public License for more details.
14
+ *
15
  * This header and all notices must be kept intact.
16
+ *
17
  * @author Karim Rahimpur
18
  * @package groups
19
  * @since groups 1.0.0
30
 
31
  /**
32
  * Groups plugin option key.
33
+ *
34
  * @var string
35
  */
36
+ const option_key = 'groups_options';
37
 
38
  /**
39
  * General option index.
40
+ *
41
  * @var string
42
  */
43
  const general = 'general';
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  /**
46
  * Registers Groups options (not autoloaded).
47
  */
87
 
88
  /**
89
  * Returns the value of a user setting.
90
+ *
91
  * @param string $option the option id
92
  * @param mixed $default default value to retrieve if option is not set
93
  * @param int $user_id retrieve option for this user, defaults to null for current user
162
 
163
  /**
164
  * Deletes a user setting.
165
+ *
166
  * @param string $option the option's id
167
  * @param int $user_id delete option for this user, defaults to null for current user
168
  */
lib/core/class-groups-pagination.php CHANGED
@@ -1,19 +1,19 @@
1
  <?php
2
  /**
3
  * class-groups-pagination.php
4
- *
5
  * Copyright (c) "kento" Karim Rahimpur www.itthinx.com
6
- *
7
  * This code is released under the GNU General Public License.
8
  * See COPYRIGHT.txt and LICENSE.txt.
9
- *
10
  * This code is distributed in the hope that it will be useful,
11
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
  * GNU General Public License for more details.
14
- *
15
  * This header and all notices must be kept intact.
16
- *
17
  * @author Karim Rahimpur
18
  * @package groups
19
  * @since groups 1.0.0
@@ -29,12 +29,12 @@ if ( !defined( 'ABSPATH' ) ) {
29
  class Groups_Pagination {
30
 
31
  /**
32
- *
33
  * @param int $total_items how many items there are to display
34
  * @param int $total_pages how many pages there are, normally leave set to null
35
  * @param int $per_page how many results to show on each page
36
  */
37
- function __construct( $total_items, $total_pages, $per_page ) {
38
  $this->set_pagination_args(
39
  array(
40
  'total_items' => $total_items,
@@ -48,7 +48,7 @@ class Groups_Pagination {
48
  * Get the current page number
49
  * @return int the current page number
50
  */
51
- function get_pagenum() {
52
  $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
53
  if ( !isset( $_REQUEST['paged'] ) ) { // needed with rewritten page added
54
  if ( preg_match( "/(\/page\/)(\d+)/", $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], $matches ) ) {
@@ -68,7 +68,7 @@ class Groups_Pagination {
68
  * @param array $args An associative array with information about the pagination
69
  * @access protected
70
  */
71
- function set_pagination_args( $args ) {
72
  $args = wp_parse_args( $args, array(
73
  'total_items' => 0,
74
  'total_pages' => 0,
@@ -86,7 +86,7 @@ class Groups_Pagination {
86
  * @param string $which where it's displayed
87
  * @param boolean $echo displays if true, otherwise returns
88
  */
89
- function pagination( $which, $echo = false ) {
90
 
91
  if ( empty( $this->_pagination_args ) )
92
  return;
1
  <?php
2
  /**
3
  * class-groups-pagination.php
4
+ *
5
  * Copyright (c) "kento" Karim Rahimpur www.itthinx.com
6
+ *
7
  * This code is released under the GNU General Public License.
8
  * See COPYRIGHT.txt and LICENSE.txt.
9
+ *
10
  * This code is distributed in the hope that it will be useful,
11
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
  * GNU General Public License for more details.
14
+ *
15
  * This header and all notices must be kept intact.
16
+ *
17
  * @author Karim Rahimpur
18
  * @package groups
19
  * @since groups 1.0.0
29
  class Groups_Pagination {
30
 
31
  /**
32
+ *
33
  * @param int $total_items how many items there are to display
34
  * @param int $total_pages how many pages there are, normally leave set to null
35
  * @param int $per_page how many results to show on each page
36
  */
37
+ public function __construct( $total_items, $total_pages, $per_page ) {
38
  $this->set_pagination_args(
39
  array(
40
  'total_items' => $total_items,
48
  * Get the current page number
49
  * @return int the current page number
50
  */
51
+ public function get_pagenum() {
52
  $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
53
  if ( !isset( $_REQUEST['paged'] ) ) { // needed with rewritten page added
54
  if ( preg_match( "/(\/page\/)(\d+)/", $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], $matches ) ) {
68
  * @param array $args An associative array with information about the pagination
69
  * @access protected
70
  */
71
+ public function set_pagination_args( $args ) {
72
  $args = wp_parse_args( $args, array(
73
  'total_items' => 0,
74
  'total_pages' => 0,
86
  * @param string $which where it's displayed
87
  * @param boolean $echo displays if true, otherwise returns
88
  */
89
+ public function pagination( $which, $echo = false ) {
90
 
91
  if ( empty( $this->_pagination_args ) )
92
  return;
lib/core/class-groups-user-capability.php CHANGED
@@ -45,7 +45,7 @@ class Groups_User_Capability {
45
 
46
  /**
47
  * Persist a user-capability relation.
48
- *
49
  * @param array $map attributes - must provide user_id and capability_id
50
  * @return true on success, otherwise false
51
  */
@@ -86,7 +86,7 @@ class Groups_User_Capability {
86
 
87
  /**
88
  * Retrieve a user-capability relation.
89
- *
90
  * @param int $user_id user's id
91
  * @param int $capability_id capability's id
92
  * @return object upon success, otherwise false
@@ -109,9 +109,9 @@ class Groups_User_Capability {
109
 
110
  /**
111
  * Update user-capability relation.
112
- *
113
  * This changes nothing so as of now it's pointless to even call this.
114
- *
115
  * @param array $map
116
  * @return true if successful, false otherwise
117
  */
@@ -130,7 +130,7 @@ class Groups_User_Capability {
130
 
131
  /**
132
  * Remove user-capability relation.
133
- *
134
  * @param int $user_id
135
  * @param int $capability_id
136
  * @return true if successful, false otherwise
45
 
46
  /**
47
  * Persist a user-capability relation.
48
+ *
49
  * @param array $map attributes - must provide user_id and capability_id
50
  * @return true on success, otherwise false
51
  */
86
 
87
  /**
88
  * Retrieve a user-capability relation.
89
+ *
90
  * @param int $user_id user's id
91
  * @param int $capability_id capability's id
92
  * @return object upon success, otherwise false
109
 
110
  /**
111
  * Update user-capability relation.
112
+ *
113
  * This changes nothing so as of now it's pointless to even call this.
114
+ *
115
  * @param array $map
116
  * @return true if successful, false otherwise
117
  */
130
 
131
  /**
132
  * Remove user-capability relation.
133
+ *
134
  * @param int $user_id
135
  * @param int $capability_id
136
  * @return true if successful, false otherwise
lib/core/class-groups-user-group.php CHANGED
@@ -60,11 +60,11 @@ class Groups_User_Group {
60
 
61
  /**
62
  * Retrieve a property by name.
63
- *
64
  * Possible properties:
65
  * - user_id
66
  * - group_id
67
- *
68
  * @param string $name property's name
69
  *
70
  * @return mixed property value, will return null if property does not exist
@@ -87,7 +87,7 @@ class Groups_User_Group {
87
  *
88
  * As of Groups 2.2.0, this is not invoked when entries for existing users are created on
89
  * plugin activation, thus the 'groups_created_user_group' action is not called for these.
90
- *
91
  * @param array $map attributes - must provide user_id and group_id
92
  * @return true on success, otherwise false
93
  */
@@ -134,7 +134,7 @@ class Groups_User_Group {
134
 
135
  /**
136
  * Retrieve a user-group relation.
137
- *
138
  * @param int $user_id user's id
139
  * @param int $group_id group's id
140
  * @return object upon success, otherwise false
@@ -157,10 +157,10 @@ class Groups_User_Group {
157
 
158
  /**
159
  * Update user-group relation.
160
- *
161
  * This is a relation and as the relation is, this does nothing and
162
  * it SHOULD do nothing.
163
- *
164
  * @param array $map
165
  * @return true on success, otherwise false
166
  */
@@ -179,7 +179,7 @@ class Groups_User_Group {
179
 
180
  /**
181
  * Remove user-group relation.
182
- *
183
  * @param int $user_id
184
  * @param int $group_id
185
  * @return true if successful, false otherwise
@@ -213,7 +213,7 @@ class Groups_User_Group {
213
  /**
214
  * Hooks into the deleted_user action to remove the deleted user from
215
  * all groups it belongs to.
216
- *
217
  * @param int $user_id
218
  */
219
  public static function deleted_user( $user_id ) {
@@ -227,7 +227,7 @@ class Groups_User_Group {
227
  if ( $rows ) {
228
  foreach( $rows as $row ) {
229
  // don't optimize that in preference of a standard deletion
230
- // process (trigger actions ...)
231
  self::delete( $row->user_id, $row->group_id );
232
  }
233
  }
@@ -236,10 +236,10 @@ class Groups_User_Group {
236
  /**
237
  * Hooks into the remove_user_from_blog action to remove the user
238
  * from groups that belong to that blog.
239
- *
240
  * Note that this is preemptive as there is no
241
  * removed_user_from_blog action.
242
- *
243
  * @param int $user_id
244
  * @param int $blog_id
245
  */
@@ -253,7 +253,7 @@ class Groups_User_Group {
253
 
254
  $group_table = _groups_get_tablename( 'group' );
255
  $user_group_table = _groups_get_tablename( 'user_group' );
256
- // We can end up here while a blog is being deleted, in that case,
257
  // the tables have already been deleted.
258
  if ( ( $wpdb->get_var( "SHOW TABLES LIKE '" . $group_table . "'" ) == $group_table ) &&
259
  ( $wpdb->get_var( "SHOW TABLES LIKE '" . $user_group_table . "'" ) == $user_group_table )
60
 
61
  /**
62
  * Retrieve a property by name.
63
+ *
64
  * Possible properties:
65
  * - user_id
66
  * - group_id
67
+ *
68
  * @param string $name property's name
69
  *
70
  * @return mixed property value, will return null if property does not exist
87
  *
88
  * As of Groups 2.2.0, this is not invoked when entries for existing users are created on
89
  * plugin activation, thus the 'groups_created_user_group' action is not called for these.
90
+ *
91
  * @param array $map attributes - must provide user_id and group_id
92
  * @return true on success, otherwise false
93
  */
134
 
135
  /**
136
  * Retrieve a user-group relation.
137
+ *
138
  * @param int $user_id user's id
139
  * @param int $group_id group's id
140
  * @return object upon success, otherwise false
157
 
158
  /**
159
  * Update user-group relation.
160
+ *
161
  * This is a relation and as the relation is, this does nothing and
162
  * it SHOULD do nothing.
163
+ *
164
  * @param array $map
165
  * @return true on success, otherwise false
166
  */
179
 
180
  /**
181
  * Remove user-group relation.
182
+ *
183
  * @param int $user_id
184
  * @param int $group_id
185
  * @return true if successful, false otherwise
213
  /**
214
  * Hooks into the deleted_user action to remove the deleted user from
215
  * all groups it belongs to.
216
+ *
217
  * @param int $user_id
218
  */
219
  public static function deleted_user( $user_id ) {
227
  if ( $rows ) {
228
  foreach( $rows as $row ) {
229
  // don't optimize that in preference of a standard deletion
230
+ // process (trigger actions ...)
231
  self::delete( $row->user_id, $row->group_id );
232
  }
233
  }
236
  /**
237
  * Hooks into the remove_user_from_blog action to remove the user
238
  * from groups that belong to that blog.
239
+ *
240
  * Note that this is preemptive as there is no
241
  * removed_user_from_blog action.
242
+ *
243
  * @param int $user_id
244
  * @param int $blog_id
245
  */
253
 
254
  $group_table = _groups_get_tablename( 'group' );
255
  $user_group_table = _groups_get_tablename( 'user_group' );
256
+ // We can end up here while a blog is being deleted, in that case,
257
  // the tables have already been deleted.
258
  if ( ( $wpdb->get_var( "SHOW TABLES LIKE '" . $group_table . "'" ) == $group_table ) &&
259
  ( $wpdb->get_var( "SHOW TABLES LIKE '" . $user_group_table . "'" ) == $user_group_table )
lib/core/class-groups-user.php CHANGED
@@ -43,7 +43,7 @@ class Groups_User implements I_Capable {
43
 
44
  /**
45
  * User object.
46
- *
47
  * @var WP_User
48
  */
49
  var $user = null;
@@ -319,7 +319,7 @@ class Groups_User implements I_Capable {
319
 
320
  /**
321
  * Returns true if the user belongs to the group.
322
- *
323
  * @param int $group_id
324
  * @return boolean
325
  */
@@ -342,7 +342,7 @@ class Groups_User implements I_Capable {
342
  * Builds the cache entries for user groups and capabilities if needed.
343
  * The cache entries are built only if they do not already exist.
344
  * If you want them rebuilt, delete them before calling.
345
- *
346
  * @param array $capability_ids carries the capability ids for the user on return, but only if cache entries have been built; will provide an empty array by default
347
  * @param array $capabilities carries the capabilities for the user on return, but only if cache entries have been built; will provide an empty array by default
348
  * @param array $group_ids carries the group ids for the user on return, but only if cache entries have been built; will provide an empty array by default
43
 
44
  /**
45
  * User object.
46
+ *
47
  * @var WP_User
48
  */
49
  var $user = null;
319
 
320
  /**
321
  * Returns true if the user belongs to the group.
322
+ *
323
  * @param int $group_id
324
  * @return boolean
325
  */
342
  * Builds the cache entries for user groups and capabilities if needed.
343
  * The cache entries are built only if they do not already exist.
344
  * If you want them rebuilt, delete them before calling.
345
+ *
346
  * @param array $capability_ids carries the capability ids for the user on return, but only if cache entries have been built; will provide an empty array by default
347
  * @param array $capabilities carries the capabilities for the user on return, but only if cache entries have been built; will provide an empty array by default
348
  * @param array $group_ids carries the group ids for the user on return, but only if cache entries have been built; will provide an empty array by default
lib/core/class-groups-utility.php CHANGED
@@ -30,7 +30,7 @@ class Groups_Utility {
30
 
31
  /**
32
  * Checks an id (0 is accepted => anonymous).
33
- *
34
  * @param string|int $id
35
  * @return int|boolean if validated, the id as an int, otherwise false
36
  */
30
 
31
  /**
32
  * Checks an id (0 is accepted => anonymous).
33
+ *
34
  * @param string|int $id
35
  * @return int|boolean if validated, the id as an int, otherwise false
36
  */
lib/core/constants.php CHANGED
@@ -30,7 +30,7 @@ define( 'GROUPS_DEFAULT_VERSION', '1.0.0' );
30
 
31
  /**
32
  * Do NOT remove this constant.
33
- *
34
  * @var string plugin domain
35
  */
36
  define( 'GROUPS_PLUGIN_DOMAIN', 'groups' );
30
 
31
  /**
32
  * Do NOT remove this constant.
33
+ *
34
  * @var string plugin domain
35
  */
36
  define( 'GROUPS_PLUGIN_DOMAIN', 'groups' );
lib/core/interface-i-capable.php CHANGED
@@ -30,9 +30,9 @@ interface I_Capable {
30
 
31
  /**
32
  * Finds out if I have the given capability.
33
- *
34
  * @param string|int $capability capability or capability id
35
  * @return true if I can, otherwise false
36
  */
37
- public function can( $capability );
38
  }
30
 
31
  /**
32
  * Finds out if I have the given capability.
33
+ *
34
  * @param string|int $capability capability or capability id
35
  * @return true if I can, otherwise false
36
  */
37
+ public function can( $capability );
38
  }
lib/extra/class-groups-extra.php CHANGED
@@ -41,10 +41,10 @@ class Groups_Extra {
41
  * Up-sell and cross-sell products are obtained directly by their ids and
42
  * no normal filters are executed that would hide them. This filter is used
43
  * instead to determine the visibility.
44
- *
45
  * If at some point we had a get_post filter in WordPress, it could filter these
46
  * and we wouldn't need this.
47
- *
48
  * @param boolean $visible
49
  * @param int $product_id
50
  * @return boolean
41
  * Up-sell and cross-sell products are obtained directly by their ids and
42
  * no normal filters are executed that would hide them. This filter is used
43
  * instead to determine the visibility.
44
+ *
45
  * If at some point we had a get_post filter in WordPress, it could filter these
46
  * and we wouldn't need this.
47
+ *
48
  * @param boolean $visible
49
  * @param int $product_id
50
  * @return boolean
lib/test/groups-tests.php CHANGED
@@ -90,7 +90,7 @@ if ( defined( 'ABSPATH' ) ) {
90
  assert( 'Groups_Capability::read_by_capability( "dance" )' );
91
 
92
 
93
- // *** users ***
94
 
95
  // create test users
96
  $fooname = 'foo' . rand(0, 100);
@@ -115,7 +115,7 @@ if ( defined( 'ABSPATH' ) ) {
115
  assert( '$dol_user_id instanceof WP_Error === false');
116
 
117
  // this user is a simple editor, used to test WordPress capabilities
118
- $editorname = 'rotide' . rand(0, 100);
119
  $editor_user_id = wp_create_user( $editorname, 'rotide', $editorname . '@example.com' );
120
  assert( '$editor_user_id instanceof WP_Error === false');
121
  if ( !( $editor_user_id instanceof WP_Error ) ) {
@@ -231,7 +231,7 @@ if ( defined( 'ABSPATH' ) ) {
231
  assert( '!$baz->can( $sing_capability_id )' );
232
  assert( '$bar->can( $sing_capability_id )' );
233
 
234
- // only foo & baz can clap
235
  assert( '$foo->can( "clap" )' );
236
  assert( '!$dol->can( "clap" )' );
237
  assert( '$baz->can( "clap" )' );
@@ -412,7 +412,7 @@ if ( defined( 'ABSPATH' ) ) {
412
  echo '<input name="run" value="run" type="hidden" />';
413
  echo '<input type="submit" value="Go" />';
414
  wp_nonce_field( 'run-tests', 'groups-test-nonce', true, true );
415
- echo '</form>';
416
  }
417
 
418
  }
90
  assert( 'Groups_Capability::read_by_capability( "dance" )' );
91
 
92
 
93
+ // *** users ***
94
 
95
  // create test users
96
  $fooname = 'foo' . rand(0, 100);
115
  assert( '$dol_user_id instanceof WP_Error === false');
116
 
117
  // this user is a simple editor, used to test WordPress capabilities
118
+ $editorname = 'rotide' . rand(0, 100);
119
  $editor_user_id = wp_create_user( $editorname, 'rotide', $editorname . '@example.com' );
120
  assert( '$editor_user_id instanceof WP_Error === false');
121
  if ( !( $editor_user_id instanceof WP_Error ) ) {
231
  assert( '!$baz->can( $sing_capability_id )' );
232
  assert( '$bar->can( $sing_capability_id )' );
233
 
234
+ // only foo & baz can clap
235
  assert( '$foo->can( "clap" )' );
236
  assert( '!$dol->can( "clap" )' );
237
  assert( '$baz->can( "clap" )' );
412
  echo '<input name="run" value="run" type="hidden" />';
413
  echo '<input type="submit" value="Go" />';
414
  wp_nonce_field( 'run-tests', 'groups-test-nonce', true, true );
415
+ echo '</form>';
416
  }
417
 
418
  }
lib/views/class-groups-shortcodes.php CHANGED
@@ -50,7 +50,7 @@ class Groups_Shortcodes {
50
 
51
  /**
52
  * Renders the Groups login form.
53
- *
54
  * The user is redirected to the current page after login by default.
55
  * The user can be redirected to a specific URL after login by
56
  * indicating the <code>redirect</code> attribute.
@@ -94,7 +94,7 @@ class Groups_Shortcodes {
94
 
95
  /**
96
  * Renders the Groups logout link.
97
- *
98
  * The link is rendered if the user is logged in.
99
  * The user is redirected to the current page after logout by default.
100
  * The user can be redirected to a specific URL after logout by
@@ -132,7 +132,7 @@ class Groups_Shortcodes {
132
  * - "format" :
133
  * - "single" : used with show="count", single form, defaults to '1'
134
  * - "plural" : used with show="count", plural form, defaults to '%d', must contain %d to show number
135
- *
136
  * @param array $atts attributes
137
  * @param string $content content to render
138
  *
@@ -207,7 +207,7 @@ class Groups_Shortcodes {
207
  * - "item_class" : defaults to "name"
208
  * - "order_by" : defaults to "name", also accepts "group_id"
209
  * - "order" : default to "ASC", also accepts "asc", "desc" and "DESC"
210
- *
211
  * @param array $atts attributes
212
  * @param string $content not used
213
  *
@@ -355,7 +355,7 @@ class Groups_Shortcodes {
355
 
356
  /**
357
  * Group comparison by name.
358
- *
359
  * @param Groups_Group $a
360
  * @param Groups_Group $b
361
  * @return int
@@ -455,7 +455,7 @@ class Groups_Shortcodes {
455
  * Renders a form that lets a user join a group.
456
  * * Attributes:
457
  * - "group" : (required) group name or id
458
- *
459
  * @param array $atts attributes
460
  * @param string $content not used
461
  */
50
 
51
  /**
52
  * Renders the Groups login form.
53
+ *
54
  * The user is redirected to the current page after login by default.
55
  * The user can be redirected to a specific URL after login by
56
  * indicating the <code>redirect</code> attribute.
94
 
95
  /**
96
  * Renders the Groups logout link.
97
+ *
98
  * The link is rendered if the user is logged in.
99
  * The user is redirected to the current page after logout by default.
100
  * The user can be redirected to a specific URL after logout by
132
  * - "format" :
133
  * - "single" : used with show="count", single form, defaults to '1'
134
  * - "plural" : used with show="count", plural form, defaults to '%d', must contain %d to show number
135
+ *
136
  * @param array $atts attributes
137
  * @param string $content content to render
138
  *
207
  * - "item_class" : defaults to "name"
208
  * - "order_by" : defaults to "name", also accepts "group_id"
209
  * - "order" : default to "ASC", also accepts "asc", "desc" and "DESC"
210
+ *
211
  * @param array $atts attributes
212
  * @param string $content not used
213
  *
355
 
356
  /**
357
  * Group comparison by name.
358
+ *
359
  * @param Groups_Group $a
360
  * @param Groups_Group $b
361
  * @return int
455
  * Renders a form that lets a user join a group.
456
  * * Attributes:
457
  * - "group" : (required) group name or id
458
+ *
459
  * @param array $atts attributes
460
  * @param string $content not used
461
  */
lib/views/class-groups-uie.php CHANGED
@@ -25,10 +25,10 @@ if ( !defined( 'ABSPATH' ) ) {
25
 
26
  /**
27
  * User Interface Extensions.
28
- *
29
  * This class may yet be subject to changes in method signatures. External
30
  * dependency is not advised until the private access restriction is removed.
31
- *
32
  * @access private
33
  */
34
  class Groups_UIE {
@@ -47,7 +47,7 @@ class Groups_UIE {
47
 
48
  /**
49
  * Extension chooser - determines what UI extension is used for an element.
50
- *
51
  * @param string $element choices: select
52
  * @param string $extension choices: selectize
53
  */
25
 
26
  /**
27
  * User Interface Extensions.
28
+ *
29
  * This class may yet be subject to changes in method signatures. External
30
  * dependency is not advised until the private access restriction is removed.
31
+ *
32
  * @access private
33
  */
34
  class Groups_UIE {
47
 
48
  /**
49
  * Extension chooser - determines what UI extension is used for an element.
50
+ *
51
  * @param string $element choices: select
52
  * @param string $extension choices: selectize
53
  */
lib/wp/class-groups-wordpress.php CHANGED
@@ -62,7 +62,7 @@ class Groups_WordPress {
62
 
63
  /**
64
  * Hook into actions to extend user capabilities.
65
- *
66
  * @todo We might want to keep up with new capabilities when added, so
67
  * that others don't have to add these explicitly to Groups when they
68
  * add them to WordPress. Currently there's no hook for when a capability
@@ -76,7 +76,7 @@ class Groups_WordPress {
76
 
77
  /**
78
  * Extends Groups user capability with its WP_User capability.
79
- *
80
  * @param string $result
81
  * @param Groups_User $groups_user
82
  * @param string $capability
@@ -98,7 +98,7 @@ class Groups_WordPress {
98
 
99
  /**
100
  * Extend user capabilities with Groups user capabilities.
101
- *
102
  * @param array $allcaps the capabilities the user has
103
  * @param array $caps the requested capabilities
104
  * @param array $args capability context which can provide the requested capability as $args[0], the user ID as $args[1] and the related object's ID as $args[2]
62
 
63
  /**
64
  * Hook into actions to extend user capabilities.
65
+ *
66
  * @todo We might want to keep up with new capabilities when added, so
67
  * that others don't have to add these explicitly to Groups when they
68
  * add them to WordPress. Currently there's no hook for when a capability
76
 
77
  /**
78
  * Extends Groups user capability with its WP_User capability.
79
+ *
80
  * @param string $result
81
  * @param Groups_User $groups_user
82
  * @param string $capability
98
 
99
  /**
100
  * Extend user capabilities with Groups user capabilities.
101
+ *
102
  * @param array $allcaps the capabilities the user has
103
  * @param array $caps the requested capabilities
104
  * @param array $args capability context which can provide the requested capability as $args[0], the user ID as $args[1] and the related object's ID as $args[2]
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: itthinx, proaktion
3
  Donate link: https://www.itthinx.com/shop/
4
  Tags: groups, access, access control, membership, memberships, member, members, capability, capabilities, content, download, downloads, file, file access, files, paypal, permission, permissions, subscription, subscriptions, woocommerce
5
  Requires at least: 5.2
6
- Tested up to: 5.6
7
  Requires PHP: 5.6.0
8
- Stable tag: 2.12.0
9
  License: GPLv3
10
 
11
  Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
3
  Donate link: https://www.itthinx.com/shop/
4
  Tags: groups, access, access control, membership, memberships, member, members, capability, capabilities, content, download, downloads, file, file access, files, paypal, permission, permissions, subscription, subscriptions, woocommerce
5
  Requires at least: 5.2
6
+ Tested up to: 5.7
7
  Requires PHP: 5.6.0
8
+ Stable tag: 2.13.0
9
  License: GPLv3
10
 
11
  Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.