Advanced Access Manager - Version 4.0.1

Version Description

  • Fixed bug with login redirect
  • Fixed minor bug with PHP Warnings on Utilities tab
  • Fixed post filtering bug
  • Updated login shortcode
Download this release

Release Info

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

Code changes from version 4.0 to 4.0.1

Application/Backend/Filter.php CHANGED
@@ -56,7 +56,7 @@ class AAM_Backend_Filter {
56
 
57
  //add post filter for LIST restriction
58
  if (!AAM::isAAM()) {
59
- add_filter('the_posts', array($this, 'thePosts'), 999, 2);
60
  if (AAM_Core_Config::get('large-post-number', false)) {
61
  add_action('pre_get_posts', array($this, 'preparePostQuery'));
62
  }
@@ -284,6 +284,7 @@ class AAM_Backend_Filter {
284
  } else {
285
  foreach ($posts as $post) {
286
  $object = AAM::getUser()->getObject('post', $post->ID);
 
287
  $list = $object->has('backend.list');
288
  $others = $object->has('backend.list_others');
289
 
@@ -304,10 +305,18 @@ class AAM_Backend_Filter {
304
  if ($this->skip === false) {
305
  $filtered = array();
306
 
307
- if (AAM_Core_Cache::has('post__not_in')) {
308
- $filtered = AAM_Core_Cache::get('post__not_in');
 
 
 
 
 
 
 
 
309
  } else {
310
- foreach ($this->fetchPosts($query) as $id) {
311
  $object = AAM::getUser()->getObject('post', $id);
312
  $list = $object->has('backend.list');
313
  $others = $object->has('backend.list_others');
@@ -316,7 +325,7 @@ class AAM_Backend_Filter {
316
  $filtered[] = $id;
317
  }
318
  }
319
- AAM_Core_Cache::set(AAM::getUser(), 'post__not_in', $filtered);
320
  }
321
 
322
  if (isset($query->query_vars['post__not_in'])) {
@@ -331,20 +340,12 @@ class AAM_Backend_Filter {
331
 
332
  /**
333
  *
334
- * @param type $query
335
  * @return type
336
  */
337
- protected function fetchPosts($query) {
338
  $this->skip = true;
339
 
340
- if (!empty($query->query['post_type'])) {
341
- $postType = $query->query['post_type'];
342
- } elseif (!empty($query->query_vars['post_type'])) {
343
- $postType = $query->query_vars['post_type'];
344
- } else {
345
- $postType = 'post';
346
- }
347
-
348
  $posts = get_posts(array(
349
  'post_type' => (is_string($postType) ? $postType : 'post'),
350
  'numberposts' => -1,
56
 
57
  //add post filter for LIST restriction
58
  if (!AAM::isAAM()) {
59
+ add_filter('the_posts', array($this, 'thePosts'), 10, 2);
60
  if (AAM_Core_Config::get('large-post-number', false)) {
61
  add_action('pre_get_posts', array($this, 'preparePostQuery'));
62
  }
284
  } else {
285
  foreach ($posts as $post) {
286
  $object = AAM::getUser()->getObject('post', $post->ID);
287
+
288
  $list = $object->has('backend.list');
289
  $others = $object->has('backend.list_others');
290
 
305
  if ($this->skip === false) {
306
  $filtered = array();
307
 
308
+ if (!empty($query->query['post_type'])) {
309
+ $postType = $query->query['post_type'];
310
+ } elseif (!empty($query->query_vars['post_type'])) {
311
+ $postType = $query->query_vars['post_type'];
312
+ } else {
313
+ $postType = 'post';
314
+ }
315
+
316
+ if (AAM_Core_Cache::has($postType . '__not_in')) {
317
+ $filtered = AAM_Core_Cache::get($postType . '__not_in');
318
  } else {
319
+ foreach ($this->fetchPosts($postType) as $id) {
320
  $object = AAM::getUser()->getObject('post', $id);
321
  $list = $object->has('backend.list');
322
  $others = $object->has('backend.list_others');
325
  $filtered[] = $id;
326
  }
327
  }
328
+ AAM_Core_Cache::set(AAM::getUser(), $postType. '__not_in', $filtered);
329
  }
330
 
331
  if (isset($query->query_vars['post__not_in'])) {
340
 
341
  /**
342
  *
343
+ * @param type $postType
344
  * @return type
345
  */
346
+ protected function fetchPosts($postType) {
347
  $this->skip = true;
348
 
 
 
 
 
 
 
 
 
349
  $posts = get_posts(array(
350
  'post_type' => (is_string($postType) ? $postType : 'post'),
351
  'numberposts' => -1,
Application/Frontend/Manager.php CHANGED
@@ -111,9 +111,11 @@ class AAM_Frontend_Manager {
111
 
112
  //if Login redirect is defined
113
  $type = $object->get('login.redirect.type');
114
- $redirect = AAM_Core_Request::request('redirect_to');
115
 
116
- if (empty($redirect) &&!empty($type) && $type !== 'default') {
 
 
117
  $redirect = $object->get("login.redirect.{$type}");
118
  AAM_Core_API::redirect($redirect);
119
  }
111
 
112
  //if Login redirect is defined
113
  $type = $object->get('login.redirect.type');
114
+ $redirect = AAM_Core_Request::request('aam_redirect');
115
 
116
+ if (!empty($redirect)) {
117
+ AAM_Core_API::redirect($redirect);
118
+ }elseif (!empty($type) && $type !== 'default') {
119
  $redirect = $object->get("login.redirect.{$type}");
120
  AAM_Core_API::redirect($redirect);
121
  }
Application/Shortcode/Strategy/Login.php CHANGED
@@ -55,7 +55,10 @@ class AAM_Shortcode_Strategy_Login implements AAM_Shortcode_Strategy_Interface {
55
  if (isset($this->args['callback'])) {
56
  $button = call_user_func($this->args['callback'], $this);
57
  } else {
58
- $button = '<a href="' . wp_login_url($redirect) . '" ';
 
 
 
59
  $button .= 'class="' . $class . '">' . $label . '</a>';
60
  }
61
 
55
  if (isset($this->args['callback'])) {
56
  $button = call_user_func($this->args['callback'], $this);
57
  } else {
58
+ $url = str_replace(
59
+ 'redirect_to=', 'aam_redirect=', wp_login_url($redirect)
60
+ );
61
+ $button = '<a href="' . $url . '" ';
62
  $button .= 'class="' . $class . '">' . $label . '</a>';
63
  }
64
 
aam.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: Manage website access for any user, role or visitors
6
- Version: 4.0
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: https://www.vasyltech.com
9
 
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: Manage website access for any user, role or visitors
6
+ Version: 4.0.1
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: https://www.vasyltech.com
9
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: vasyltech
3
  Tags: access, role, user, visitor, capability, page, post, permission, security, login redirect, brute force attack, double authentication, widget, membership
4
  Requires at least: 3.8
5
  Tested up to: 4.7.2
6
- Stable tag: 4.0
7
 
8
  Manage your website access and security for any user, role or visitors.
9
 
@@ -92,6 +92,12 @@ Check our [help page](https://aamplugin.com/help) to find out more about AAM.
92
 
93
  == Changelog ==
94
 
 
 
 
 
 
 
95
  = 4.0 =
96
  * Added link Access to category list
97
  * Added shortcode [aam] to manage access to the post's content
3
  Tags: access, role, user, visitor, capability, page, post, permission, security, login redirect, brute force attack, double authentication, widget, membership
4
  Requires at least: 3.8
5
  Tested up to: 4.7.2
6
+ Stable tag: 4.0.1
7
 
8
  Manage your website access and security for any user, role or visitors.
9
 
92
 
93
  == Changelog ==
94
 
95
+ = 4.0.1 =
96
+ * Fixed bug with login redirect
97
+ * Fixed minor bug with PHP Warnings on Utilities tab
98
+ * Fixed post filtering bug
99
+ * Updated login shortcode
100
+
101
  = 4.0 =
102
  * Added link Access to category list
103
  * Added shortcode [aam] to manage access to the post's content