Groups - Version 1.7.1

Version Description

  • Fixes an issue with map_meta_cap filtering where no valid post ID is provided.
Download this release

Release Info

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

Code changes from version 1.7.0 to 1.7.1

groups.php CHANGED
@@ -21,7 +21,7 @@
21
  * Plugin Name: Groups
22
  * Plugin URI: http://www.itthinx.com/plugins/groups
23
  * Description: Groups provides group-based user membership management, group-based capabilities and content access control.
24
- * Version: 1.7.0
25
  * Author: itthinx
26
  * Author URI: http://www.itthinx.com
27
  * Donate-Link: http://www.itthinx.com
@@ -30,7 +30,7 @@
30
  if ( !defined( 'ABSPATH' ) ) {
31
  exit;
32
  }
33
- define( 'GROUPS_CORE_VERSION', '1.7.0' );
34
  define( 'GROUPS_FILE', __FILE__ );
35
  if ( !defined( 'GROUPS_CORE_DIR' ) ) {
36
  define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
21
  * Plugin Name: Groups
22
  * Plugin URI: http://www.itthinx.com/plugins/groups
23
  * Description: Groups provides group-based user membership management, group-based capabilities and content access control.
24
+ * Version: 1.7.1
25
  * Author: itthinx
26
  * Author URI: http://www.itthinx.com
27
  * Donate-Link: http://www.itthinx.com
30
  if ( !defined( 'ABSPATH' ) ) {
31
  exit;
32
  }
33
+ define( 'GROUPS_CORE_VERSION', '1.7.1' );
34
  define( 'GROUPS_FILE', __FILE__ );
35
  if ( !defined( 'GROUPS_CORE_DIR' ) ) {
36
  define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
lib/access/class-groups-post-access.php CHANGED
@@ -84,6 +84,7 @@ class Groups_Post_Access {
84
 
85
  /**
86
  * Restrict access to edit or delete posts based on the post's access restrictions.
 
87
  * @param array $caps
88
  * @param string $cap
89
  * @param int $user_id
@@ -111,9 +112,16 @@ class Groups_Post_Access {
111
  }
112
 
113
  if ( $cap === $edit_post_type || $cap === $delete_post_type ) {
114
- $post_id = $args[0];
115
- if ( !self::user_can_read_post( $post_id, $user_id ) ) {
116
- $caps[] = 'do_not_allow';
 
 
 
 
 
 
 
117
  }
118
  }
119
  }
84
 
85
  /**
86
  * Restrict access to edit or delete posts based on the post's access restrictions.
87
+ *
88
  * @param array $caps
89
  * @param string $cap
90
  * @param int $user_id
112
  }
113
 
114
  if ( $cap === $edit_post_type || $cap === $delete_post_type ) {
115
+ $post_id = null;
116
+ if ( is_numeric( $args[0] ) ) {
117
+ $post_id = $args[0];
118
+ } else if ( $args[0] instanceof WP_Post ) {
119
+ $post_id = $post->ID;
120
+ }
121
+ if ( $post_id ) {
122
+ if ( !self::user_can_read_post( $post_id, $user_id ) ) {
123
+ $caps[] = 'do_not_allow';
124
+ }
125
  }
126
  }
127
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.itthinx.com/plugins/groups
4
  Tags: access, access control, capability, capabilities, content, download, downloads, file, file access, files, group, groups, member, members, membership, memberships, paypal, permission, permissions, subscription, subscriptions, woocommerce
5
  Requires at least: 4.0
6
  Tested up to: 4.2.2
7
- Stable tag: 1.7.0
8
  License: GPLv3
9
 
10
  Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
@@ -181,6 +181,9 @@ See also [Groups](http://www.itthinx.com/plugins/groups/)
181
 
182
  == Changelog ==
183
 
 
 
 
184
  = 1.7.0 =
185
  * Added the French translation.
186
  * Added the [groups_login] shortcode.
@@ -474,5 +477,5 @@ Some installations wouldn't work correctly, showing no capabilities and making i
474
 
475
  == Upgrade Notice ==
476
 
477
- = 1.7.0 =
478
- This release adds the [groups_login] and [groups_logout] shortcodes, the French translation and fixes issues with capabilities. Please back up your site and database before updating.
4
  Tags: access, access control, capability, capabilities, content, download, downloads, file, file access, files, group, groups, member, members, membership, memberships, paypal, permission, permissions, subscription, subscriptions, woocommerce
5
  Requires at least: 4.0
6
  Tested up to: 4.2.2
7
+ Stable tag: 1.7.1
8
  License: GPLv3
9
 
10
  Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
181
 
182
  == Changelog ==
183
 
184
+ = 1.7.1 =
185
+ * Fixes an issue with map_meta_cap filtering where no valid post ID is provided.
186
+
187
  = 1.7.0 =
188
  * Added the French translation.
189
  * Added the [groups_login] shortcode.
477
 
478
  == Upgrade Notice ==
479
 
480
+ = 1.7.1 =
481
+ This release fixes an issue with a PHP error thrown under circumstances related to third-party plugins.