Advanced Access Manager - Version 4.8.1

Version Description

  • Added ability to control post_password_expires with post.password.expires config
  • Improved media access
  • Improved UI
Download this release

Release Info

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

Code changes from version 4.8 to 4.8.1

Application/Backend/phtml/partial/post-advanced-settings.phtml CHANGED
@@ -80,12 +80,6 @@
80
  <label><?php echo __('Simple text or valid HTML', AAM_KEY); ?></label>
81
  <textarea class="form-control" id="teaser-value" placeholder="<?php echo __('Enter your teaser', AAM_KEY); ?>" rows="5"></textarea>
82
  </div>
83
- <div class="checkbox">
84
- <label>
85
- <input value="1" type="checkbox" id="add-excerpt" />
86
- Add excerpt before teaser message
87
- </label>
88
- </div>
89
  </div>
90
  <div class="modal-footer">
91
  <button type="button" class="btn btn-success extended-post-access-btn" id="change-teaser-btn"><?php echo __('Save', AAM_KEY); ?></button>
80
  <label><?php echo __('Simple text or valid HTML', AAM_KEY); ?></label>
81
  <textarea class="form-control" id="teaser-value" placeholder="<?php echo __('Enter your teaser', AAM_KEY); ?>" rows="5"></textarea>
82
  </div>
 
 
 
 
 
 
83
  </div>
84
  <div class="modal-footer">
85
  <button type="button" class="btn btn-success extended-post-access-btn" id="change-teaser-btn"><?php echo __('Save', AAM_KEY); ?></button>
Application/Core/Media.php CHANGED
@@ -92,24 +92,32 @@ class AAM_Core_Media {
92
  $media = $this->findMedia();
93
  $area = (is_admin() ? 'backend' : 'frontend');
94
 
95
- if (empty($media) || !$media->has("{$area}.read")) {
96
- $this->printMedia($media);
97
- } elseif (!empty($media)) {
98
- $args = array(
99
- 'hook' => 'media_read',
100
- 'action' => "{$area}.read",
101
- 'post' => $media->getPost()
102
- );
103
-
104
- if ($default = AAM_Core_Config::get('media.restricted.default')) {
105
- do_action('aam-rejected-action', $area, $args);
106
- $this->printMedia(get_post($default));
 
 
 
 
 
 
 
 
107
  } else {
108
- AAM_Core_API::reject($area, $args);
109
  }
110
  }
111
  } else {
112
- $this->printMedia();
113
  }
114
  }
115
 
@@ -126,8 +134,10 @@ class AAM_Core_Media {
126
 
127
  if (!empty($media)) {
128
  $mime = $media->post_mime_type;
129
- $path = get_attached_file($media->ID);
130
- } else {
 
 
131
  $path = ABSPATH . $this->request_uri;
132
  }
133
 
92
  $media = $this->findMedia();
93
  $area = (is_admin() ? 'backend' : 'frontend');
94
 
95
+ if (empty($media)) {
96
+ $this->printMedia();
97
+ } else {
98
+ $read = $media->has('frontend.read');
99
+ $others = $media->has('frontend.read_others');
100
+ $author = ($media->post_author == get_current_user_id());
101
+
102
+ if ($read || ($others && !$author)) {
103
+ $args = array(
104
+ 'hook' => 'media_read',
105
+ 'action' => "{$area}.read",
106
+ 'post' => $media->getPost()
107
+ );
108
+
109
+ if ($default = AAM_Core_Config::get('media.restricted.default')) {
110
+ do_action('aam-rejected-action', $area, $args);
111
+ $this->printMedia(get_post($default));
112
+ } else {
113
+ AAM_Core_API::reject($area, $args);
114
+ }
115
  } else {
116
+ $this->printMedia($media);
117
  }
118
  }
119
  } else {
120
+ $this->printMedia($media);
121
  }
122
  }
123
 
134
 
135
  if (!empty($media)) {
136
  $mime = $media->post_mime_type;
137
+ $path = get_attached_file($media->ID); // This can be buggy!
138
+ }
139
+
140
+ if (empty($path) || !file_exists($path)) {
141
  $path = ABSPATH . $this->request_uri;
142
  }
143
 
Application/Frontend/Manager.php CHANGED
@@ -78,6 +78,9 @@ class AAM_Frontend_Manager {
78
  //login process
79
  add_filter('login_message', array($this, 'loginMessage'));
80
 
 
 
 
81
  //admin bar
82
  $this->checkAdminBar();
83
  }
@@ -90,6 +93,21 @@ class AAM_Frontend_Manager {
90
  add_action('login_form_login', array($this, 'loginSubmit'), 1);
91
  }
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  /**
94
  *
95
  * @param type $message
@@ -222,7 +240,7 @@ class AAM_Frontend_Manager {
222
  * @access public
223
  */
224
  public function authenticate($user) {
225
- if ($user->user_status == 1) {
226
  $user = new WP_Error();
227
 
228
  $message = '[ERROR]: User is locked. Please contact your website ';
78
  //login process
79
  add_filter('login_message', array($this, 'loginMessage'));
80
 
81
+ //manage password check expiration
82
+ add_filter('post_password_expires', array($this, 'postPasswordExpires'));
83
+
84
  //admin bar
85
  $this->checkAdminBar();
86
  }
93
  add_action('login_form_login', array($this, 'loginSubmit'), 1);
94
  }
95
 
96
+ /**
97
+ *
98
+ * @param type $expire
99
+ * @return type
100
+ */
101
+ public function postPasswordExpires($expire) {
102
+ $overwrite = AAM_Core_Config::get('post.password.expires', null);
103
+
104
+ if ($overwrite !== null) {
105
+ $expire = ($overwrite ? time() + strtotime($overwrite) : 0);
106
+ }
107
+
108
+ return $expire;
109
+ }
110
+
111
  /**
112
  *
113
  * @param type $message
240
  * @access public
241
  */
242
  public function authenticate($user) {
243
+ if (is_a($user, 'WP_User') && $user->user_status == 1) {
244
  $user = new WP_Error();
245
 
246
  $message = '[ERROR]: User is locked. Please contact your website ';
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: 4.8
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: 4.8.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, role, user, capability, page access, post access, security, login redirect, brute force attack, double authentication, membership, backend lockdown, wp-admin, 404, activity tracking
4
  Requires at least: 3.8
5
  Tested up to: 4.8
6
- Stable tag: 4.8
7
 
8
  Manage access to your website for any user, role or visitors for both frontend and backend.
9
 
@@ -110,6 +110,11 @@ Check our [help page](https://aamplugin.com/help) to find out more about AAM.
110
 
111
  == Changelog ==
112
 
 
 
 
 
 
113
  = 4.8 =
114
  * Fixed the bug with Media access control reported by Antonius Hegyes
115
  * Fixed the bug with post access properties preview
1
  === Advanced Access Manager ===
2
  Contributors: vasyltech
3
+ Tags: access, role, user, capability, page access, post access, comments, security, login redirect, brute force attack, double authentication, membership, backend lockdown, wp-admin, 404, activity tracking
4
  Requires at least: 3.8
5
  Tested up to: 4.8
6
+ Stable tag: 4.8.1
7
 
8
  Manage access to your website for any user, role or visitors for both frontend and backend.
9
 
110
 
111
  == Changelog ==
112
 
113
+ = 4.8.1 =
114
+ * Added ability to control post_password_expires with post.password.expires config
115
+ * Improved media access
116
+ * Improved UI
117
+
118
  = 4.8 =
119
  * Fixed the bug with Media access control reported by Antonius Hegyes
120
  * Fixed the bug with post access properties preview