Advanced Access Manager - Version 5.4.1

Version Description

  • Fixed the bug reported by Doug Davis where newly created posts get locked if default access settings are defined
  • Fixed the bug with post visibility when /%category%/%postname%/ permalink is defined
  • Fixed the but with default category not been selected when redefined with ConfigPress
  • Improved AAM performance by caching post visibility results
Download this release

Release Info

Developer vasyl_m
Plugin Icon 128x128 Advanced Access Manager
Version 5.4.1
Comparing to
See all releases

Code changes from version 5.4 to 5.4.1

Application/Backend/Feature/Main/Capability.php CHANGED
@@ -51,7 +51,7 @@ class AAM_Backend_Feature_Main_Capability extends AAM_Backend_Feature_Abstract {
51
  'aam_manage_posts', 'aam_manage_access_denied_redirect', 'aam_create_roles',
52
  'aam_manage_login_redirect', 'aam_manage_logout_redirect', 'aam_manager',
53
  'aam_manage_settings', 'aam_manage_extensions', 'aam_show_notifications',
54
- 'aam_manage_404_redirect', 'aam_manage_ip_check', 'aam_manage_toolbar',
55
  'aam_manage_default', 'aam_manage_visitors', 'aam_list_roles',
56
  'aam_edit_roles', 'aam_delete_roles', 'aam_toggle_users', 'aam_switch_users',
57
  'aam_manage_configpress', 'aam_manage_api_routes'
51
  'aam_manage_posts', 'aam_manage_access_denied_redirect', 'aam_create_roles',
52
  'aam_manage_login_redirect', 'aam_manage_logout_redirect', 'aam_manager',
53
  'aam_manage_settings', 'aam_manage_extensions', 'aam_show_notifications',
54
+ 'aam_manage_404_redirect', 'aam_manage_ip_check', 'aam_manager_admin_toolbar',
55
  'aam_manage_default', 'aam_manage_visitors', 'aam_list_roles',
56
  'aam_edit_roles', 'aam_delete_roles', 'aam_toggle_users', 'aam_switch_users',
57
  'aam_manage_configpress', 'aam_manage_api_routes'
Application/Backend/Feature/Main/Toolbar.php CHANGED
@@ -154,7 +154,7 @@ class AAM_Backend_Feature_Main_Toolbar extends AAM_Backend_Feature_Abstract {
154
  'uid' => 'toolbar',
155
  'position' => 6,
156
  'title' => __('Admin Toolbar', AAM_KEY),
157
- 'capability' => 'aam_manage_toolbar',
158
  'type' => 'main',
159
  'subjects' => array(
160
  AAM_Core_Subject_Role::UID,
154
  'uid' => 'toolbar',
155
  'position' => 6,
156
  'title' => __('Admin Toolbar', AAM_KEY),
157
+ 'capability' => 'aam_manager_admin_toolbar',
158
  'type' => 'main',
159
  'subjects' => array(
160
  AAM_Core_Subject_Role::UID,
Application/Backend/Filter.php CHANGED
@@ -204,19 +204,15 @@ class AAM_Backend_Filter {
204
  * @staticvar type $default
205
  */
206
  public function filterDefaultCategory($category) {
207
- static $default = null;
 
 
 
208
 
209
- if (is_null($default)) {
210
- //check if user category is defined
211
- $id = get_current_user_id();
212
- $default = AAM_Core_Config::get('feature.post.defaultTerm.user.' . $id , null);
213
- $roles = AAM::getUser()->roles;
214
-
215
- if (is_null($default) && count($roles)) {
216
- $default = AAM_Core_Config::get(
217
- 'feature.post.defaultTerm.role.' . array_shift($roles), false
218
- );
219
- }
220
  }
221
 
222
  return ($default ? $default : $category);
204
  * @staticvar type $default
205
  */
206
  public function filterDefaultCategory($category) {
207
+ //check if user category is defined
208
+ $id = get_current_user_id();
209
+ $default = AAM_Core_Config::get('feature.post.defaultTerm.user.' . $id , null);
210
+ $roles = AAM::getUser()->roles;
211
 
212
+ if (is_null($default) && count($roles)) {
213
+ $default = AAM_Core_Config::get(
214
+ 'feature.post.defaultTerm.role.' . array_shift($roles), false
215
+ );
 
 
 
 
 
 
 
216
  }
217
 
218
  return ($default ? $default : $category);
Application/Core/Config.php CHANGED
@@ -73,7 +73,7 @@ class AAM_Core_Config {
73
  $response = self::readConfigPress($option, $default);
74
  }
75
 
76
- return self::normalize($response);
77
  }
78
 
79
  /**
@@ -147,7 +147,6 @@ class AAM_Core_Config {
147
  */
148
  protected static function readConfigPress($param, $default = null) {
149
  $config = AAM_Core_ConfigPress::get('aam.' . $param, $default);
150
-
151
  if (is_array($config) && isset($config['userFunc'])) {
152
  if (is_callable($config['userFunc'])) {
153
  $response = call_user_func($config['userFunc']);
73
  $response = self::readConfigPress($option, $default);
74
  }
75
 
76
+ return ($response ? self::normalize($response) : $response);
77
  }
78
 
79
  /**
147
  */
148
  protected static function readConfigPress($param, $default = null) {
149
  $config = AAM_Core_ConfigPress::get('aam.' . $param, $default);
 
150
  if (is_array($config) && isset($config['userFunc'])) {
151
  if (is_callable($config['userFunc'])) {
152
  $response = call_user_func($config['userFunc']);
Application/Core/Object/Post.php CHANGED
@@ -44,7 +44,8 @@ class AAM_Core_Object_Post extends AAM_Core_Object {
44
  $this->setPost(get_post($post));
45
  }
46
 
47
- if ($this->getPost()) {
 
48
  $this->read();
49
  }
50
  }
44
  $this->setPost(get_post($post));
45
  }
46
 
47
+ // Do not initialize settings for posts that are about to be created
48
+ if ($this->getPost() && ($this->getPost()->post_status != 'auto-draft')) {
49
  $this->read();
50
  }
51
  }
Application/Core/Object/Visibility.php CHANGED
@@ -55,14 +55,6 @@ class AAM_Core_Object_Visibility extends AAM_Core_Object {
55
  }
56
  }
57
 
58
- // Override the frontend.list for current post
59
- $post = AAM_Core_API::getCurrentPost(); // current post
60
- if ($post) {
61
- $option = $this->getOption();
62
- $option['post'][$post->ID . '|' . $post->post_type]['frontend.list'] = 0;
63
- $this->setOption($option);
64
- }
65
-
66
  do_action('aam-visibility-initialize-action', $this);
67
 
68
  // inherit settings from parent
@@ -74,9 +66,9 @@ class AAM_Core_Object_Visibility extends AAM_Core_Object {
74
  }
75
 
76
  if (in_array($subject::UID, array('user', 'visitor'))) {
77
- // $subject->getObject('cache')->add(
78
- // 'visibility', 0, empty($option) ? false : $option
79
- // );
80
  }
81
  }
82
 
55
  }
56
  }
57
 
 
 
 
 
 
 
 
 
58
  do_action('aam-visibility-initialize-action', $this);
59
 
60
  // inherit settings from parent
66
  }
67
 
68
  if (in_array($subject::UID, array('user', 'visitor'))) {
69
+ $subject->getObject('cache')->add(
70
+ 'visibility', 0, empty($option) ? false : $option
71
+ );
72
  }
73
  }
74
 
Application/Shared/Manager.php CHANGED
@@ -145,7 +145,7 @@ class AAM_Shared_Manager {
145
  * @global WPDB $wpdb
146
  */
147
  public function filterPostQuery($clauses, $wpQuery) {
148
- if ($this->isPostFilterEnabled()) {
149
  $option = AAM::getUser()->getObject('visibility')->getOption();
150
 
151
  if (!empty($option['post'])) {
@@ -157,7 +157,7 @@ class AAM_Shared_Manager {
157
  $clauses['where'] .= apply_filters(
158
  'aam-post-where-clause-filter', $query, $wpQuery, $option
159
  );
160
-
161
  $this->finalizePostQuery($clauses);
162
  }
163
 
145
  * @global WPDB $wpdb
146
  */
147
  public function filterPostQuery($clauses, $wpQuery) {
148
+ if (!$wpQuery->is_singular && $this->isPostFilterEnabled()) {
149
  $option = AAM::getUser()->getObject('visibility')->getOption();
150
 
151
  if (!empty($option['post'])) {
157
  $clauses['where'] .= apply_filters(
158
  'aam-post-where-clause-filter', $query, $wpQuery, $option
159
  );
160
+
161
  $this->finalizePostQuery($clauses);
162
  }
163
 
aam.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: All you need to manage access to your WordPress website
6
- Version: 5.4
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: https://vasyltech.com
9
 
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: All you need to manage access to your WordPress website
6
+ Version: 5.4.1
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: https://vasyltech.com
9
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Advanced Access Manager ===
2
  Contributors: vasyltech
3
- Tags: access-control, membership, access, user role, restricted content
4
  Requires at least: 4.0
5
  Tested up to: 4.9.7
6
- Stable tag: 5.4
7
 
8
  All you need to manage access to you WordPress websites on frontend, backend and API levels for any role, user or visitors.
9
 
@@ -76,6 +76,12 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
 
79
  = 5.4 =
80
  * Fixed bug with Api Access Control option that when disabled, still denies API Routes
81
  * Fixed bug when RESTful or XML-RPC disabled but endpoints still listed on API Routes
1
  === Advanced Access Manager ===
2
  Contributors: vasyltech
3
+ Tags: access control, membership, backend menu, user role, restricted content
4
  Requires at least: 4.0
5
  Tested up to: 4.9.7
6
+ Stable tag: 5.4.1
7
 
8
  All you need to manage access to you WordPress websites on frontend, backend and API levels for any role, user or visitors.
9
 
76
 
77
  == Changelog ==
78
 
79
+ = 5.4.1 =
80
+ * Fixed the bug reported by Doug Davis where newly created posts get locked if default access settings are defined
81
+ * Fixed the bug with post visibility when /%category%/%postname%/ permalink is defined
82
+ * Fixed the but with default category not been selected when redefined with ConfigPress
83
+ * Improved AAM performance by caching post visibility results
84
+
85
  = 5.4 =
86
  * Fixed bug with Api Access Control option that when disabled, still denies API Routes
87
  * Fixed bug when RESTful or XML-RPC disabled but endpoints still listed on API Routes