Groups - Version 2.0.1

Version Description

  • Fixed an issue with conflicting cache entries with legacy mode enabled.
  • Fixed access restriction capabilities were reset when reenabling legacy mode.
Download this release

Release Info

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

Code changes from version 2.0.0 to 2.0.1

changelog.txt CHANGED
@@ -1,5 +1,9 @@
1
  == Groups changelog.txt ==
2
 
 
 
 
 
3
  = 2.0.0 =
4
  * Changed the access restriction model to group-based access restrictions.
5
  * Provides an optional legacy mode that supports the previous capability-based access restrictions.
1
  == Groups changelog.txt ==
2
 
3
+ = 2.0.1 =
4
+ * Fixed an issue with conflicting cache entries with legacy mode enabled.
5
+ * Fixed access restriction capabilities were reset when reenabling legacy mode.
6
+
7
  = 2.0.0 =
8
  * Changed the access restriction model to group-based access restrictions.
9
  * Provides an optional legacy mode that supports the previous capability-based access restrictions.
groups.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * groups.php
4
  *
5
- * Copyright (c) 2011-2016 "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.
@@ -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: 2.0.0
25
  * Author: itthinx
26
  * Author URI: http://www.itthinx.com
27
  * Donate-Link: http://www.itthinx.com
@@ -32,7 +32,7 @@
32
  if ( !defined( 'ABSPATH' ) ) {
33
  exit;
34
  }
35
- define( 'GROUPS_CORE_VERSION', '2.0.0' );
36
  define( 'GROUPS_FILE', __FILE__ );
37
  if ( !defined( 'GROUPS_CORE_DIR' ) ) {
38
  define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
2
  /**
3
  * groups.php
4
  *
5
+ * Copyright (c) 2011-2017 "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.
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: 2.0.1
25
  * Author: itthinx
26
  * Author URI: http://www.itthinx.com
27
  * Donate-Link: http://www.itthinx.com
32
  if ( !defined( 'ABSPATH' ) ) {
33
  exit;
34
  }
35
+ define( 'GROUPS_CORE_VERSION', '2.0.1' );
36
  define( 'GROUPS_FILE', __FILE__ );
37
  if ( !defined( 'GROUPS_CORE_DIR' ) ) {
38
  define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
legacy/access/class-groups-post-access-legacy.php CHANGED
@@ -31,7 +31,7 @@ class Groups_Post_Access_Legacy {
31
  const POSTMETA_PREFIX = 'groups-';
32
 
33
  const CACHE_GROUP = 'groups';
34
- const CAN_READ_POST = 'can_read_post';
35
 
36
  const READ_POST_CAPABILITY = 'groups_read_post';
37
  const READ_POST_CAPABILITY_NAME = 'Read Post';
31
  const POSTMETA_PREFIX = 'groups-';
32
 
33
  const CACHE_GROUP = 'groups';
34
+ const CAN_READ_POST = 'legacy_can_read_post';
35
 
36
  const READ_POST_CAPABILITY = 'groups_read_post';
37
  const READ_POST_CAPABILITY_NAME = 'Read Post';
legacy/admin/groups-admin-options-legacy.php CHANGED
@@ -25,8 +25,9 @@ if ( !defined( 'ABSPATH' ) ) {
25
 
26
  /**
27
  * Legacy options admin screen extension.
 
28
  */
29
- function groups_admin_options_legacy() {
30
 
31
  global $wpdb;
32
 
@@ -35,7 +36,7 @@ function groups_admin_options_legacy() {
35
  //
36
  // handle legacy options after form submission
37
  //
38
- if ( isset( $_POST['submit'] ) ) {
39
  if ( wp_verify_nonce( $_POST[GROUPS_ADMIN_OPTIONS_NONCE], 'admin' ) ) {
40
  $valid_read_caps = array( Groups_Post_Access_Legacy::READ_POST_CAPABILITY );
41
  if ( !empty( $_POST[GROUPS_READ_POST_CAPABILITIES] ) ) {
25
 
26
  /**
27
  * Legacy options admin screen extension.
28
+ * @param $legacy_switched boolean whether legacy mode setting has been changed during submit
29
  */
30
+ function groups_admin_options_legacy( $legacy_switched ) {
31
 
32
  global $wpdb;
33
 
36
  //
37
  // handle legacy options after form submission
38
  //
39
+ if ( isset( $_POST['submit'] ) && !$legacy_switched ) {
40
  if ( wp_verify_nonce( $_POST[GROUPS_ADMIN_OPTIONS_NONCE], 'admin' ) ) {
41
  $valid_read_caps = array( Groups_Post_Access_Legacy::READ_POST_CAPABILITY );
42
  if ( !empty( $_POST[GROUPS_READ_POST_CAPABILITIES] ) ) {
lib/admin/groups-admin-options.php CHANGED
@@ -53,6 +53,8 @@ function groups_admin_options() {
53
  GROUPS_RESTRICT_ACCESS => __( 'Restrict Access', 'groups' )
54
  );
55
 
 
 
56
  //
57
  // handle options form submission
58
  //
@@ -294,7 +296,7 @@ function groups_admin_options() {
294
  '</p>';
295
  if ( $groups_legacy_enable ) {
296
  require_once GROUPS_LEGACY_LIB . '/admin/groups-admin-options-legacy.php';
297
- do_action( 'groups_admin_options_legacy' );
298
  }
299
 
300
  echo
53
  GROUPS_RESTRICT_ACCESS => __( 'Restrict Access', 'groups' )
54
  );
55
 
56
+ $previous_legacy_enable = Groups_Options::get_option( GROUPS_LEGACY_ENABLE, GROUPS_LEGACY_ENABLE_DEFAULT );
57
+
58
  //
59
  // handle options form submission
60
  //
296
  '</p>';
297
  if ( $groups_legacy_enable ) {
298
  require_once GROUPS_LEGACY_LIB . '/admin/groups-admin-options-legacy.php';
299
+ do_action( 'groups_admin_options_legacy', $groups_legacy_enable !== $previous_legacy_enable );
300
  }
301
 
302
  echo
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.7.2
7
- Stable tag: 2.0.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.
@@ -190,6 +190,10 @@ See also the [Groups Documentation](http://docs.itthinx.com/document/groups/) pa
190
 
191
  == Changelog ==
192
 
 
 
 
 
193
  = 2.0.0 =
194
  * Changed the access restriction model to group-based access restrictions.
195
  * Provides an optional legacy mode that supports the previous capability-based access restrictions.
@@ -206,5 +210,5 @@ See also the [Groups Documentation](http://docs.itthinx.com/document/groups/) pa
206
 
207
  == Upgrade Notice ==
208
 
209
- = 2.0.0 =
210
- Groups 2.0.0 simplifies the way access restrictions are handled.
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.7.2
7
+ Stable tag: 2.0.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.
190
 
191
  == Changelog ==
192
 
193
+ = 2.0.1 =
194
+ * Fixed an issue with conflicting cache entries with legacy mode enabled.
195
+ * Fixed access restriction capabilities were reset when reenabling legacy mode.
196
+
197
  = 2.0.0 =
198
  * Changed the access restriction model to group-based access restrictions.
199
  * Provides an optional legacy mode that supports the previous capability-based access restrictions.
210
 
211
  == Upgrade Notice ==
212
 
213
+ = 2.0.1 =
214
+ Groups 2.0.1 simplifies the way access restrictions are handled.