Version Description
- Fixed the bug with post list caching
- Fixed the bug with Manage Access button
- Added REDIRECT option to post access list
- Added redirect to existing page for Backend tab on Access Denied Redirect
- Improved caching mechanism
Download this release
Release Info
Developer | vasyl_m |
Plugin | Advanced Access Manager |
Version | 4.2 |
Comparing to | |
See all releases |
Code changes from version 4.1.1 to 4.2
- Application/Backend/Feature/Extension.php +3 -1
- Application/Backend/Feature/Post.php +1 -1
- Application/Backend/Filter.php +3 -3
- Application/Backend/View/PostOptionList.php +5 -0
- Application/Backend/phtml/index.phtml +41 -28
- Application/Backend/phtml/object/post.phtml +22 -1
- Application/Backend/phtml/object/redirect.phtml +20 -0
- Application/Core/Cache.php +2 -0
- Application/Extension/Server.php +11 -3
- Application/Frontend/Manager.php +31 -14
- aam.php +1 -1
- media/css/aam.css +5 -0
- media/js/aam-ui.js +44 -6
- readme.txt +12 -5
Application/Backend/Feature/Extension.php
CHANGED
@@ -157,7 +157,9 @@ class AAM_Backend_Feature_Extension extends AAM_Backend_Feature_Abstract {
|
|
157 |
'capability' => $cap,
|
158 |
'notification' => self::getNotification(),
|
159 |
'subjects' => array(
|
160 |
-
'AAM_Core_Subject_Role'
|
|
|
|
|
161 |
),
|
162 |
'view' => __CLASS__
|
163 |
));
|
157 |
'capability' => $cap,
|
158 |
'notification' => self::getNotification(),
|
159 |
'subjects' => array(
|
160 |
+
'AAM_Core_Subject_Role',
|
161 |
+
'AAM_Core_Subject_User',
|
162 |
+
'AAM_Core_Subject_Visitor',
|
163 |
),
|
164 |
'view' => __CLASS__
|
165 |
));
|
Application/Backend/Feature/Post.php
CHANGED
@@ -353,7 +353,7 @@ class AAM_Backend_Feature_Post extends AAM_Backend_Feature_Abstract {
|
|
353 |
*/
|
354 |
public function getCurrentObject() {
|
355 |
$object = (object) array(
|
356 |
-
'id' => urldecode(AAM_Core_Request::
|
357 |
'type' => AAM_Core_Request::post('otype')
|
358 |
);
|
359 |
|
353 |
*/
|
354 |
public function getCurrentObject() {
|
355 |
$object = (object) array(
|
356 |
+
'id' => urldecode(AAM_Core_Request::request('oid')),
|
357 |
'type' => AAM_Core_Request::post('otype')
|
358 |
);
|
359 |
|
Application/Backend/Filter.php
CHANGED
@@ -342,8 +342,8 @@ class AAM_Backend_Filter {
|
|
342 |
$postType = 'post';
|
343 |
}
|
344 |
|
345 |
-
if (AAM_Core_Cache::has($postType . '
|
346 |
-
$filtered = AAM_Core_Cache::get($postType . '
|
347 |
} else {
|
348 |
foreach ($this->fetchPosts($postType) as $id) {
|
349 |
$object = AAM::getUser()->getObject('post', $id);
|
@@ -354,7 +354,7 @@ class AAM_Backend_Filter {
|
|
354 |
$filtered[] = $id;
|
355 |
}
|
356 |
}
|
357 |
-
AAM_Core_Cache::set(AAM::getUser(), $postType. '
|
358 |
}
|
359 |
|
360 |
if (isset($query->query_vars['post__not_in'])) {
|
342 |
$postType = 'post';
|
343 |
}
|
344 |
|
345 |
+
if (AAM_Core_Cache::has($postType . '__not_in_backend')) {
|
346 |
+
$filtered = AAM_Core_Cache::get($postType . '__not_in_backend');
|
347 |
} else {
|
348 |
foreach ($this->fetchPosts($postType) as $id) {
|
349 |
$object = AAM::getUser()->getObject('post', $id);
|
354 |
$filtered[] = $id;
|
355 |
}
|
356 |
}
|
357 |
+
AAM_Core_Cache::set(AAM::getUser(), $postType. '__not_in_backend', $filtered);
|
358 |
}
|
359 |
|
360 |
if (isset($query->query_vars['post__not_in'])) {
|
Application/Backend/View/PostOptionList.php
CHANGED
@@ -33,6 +33,11 @@ return array(
|
|
33 |
'title' => __('Comment', AAM_KEY),
|
34 |
'descr' => __('Restrict access to comment on %s if commenting feature is enabled.', AAM_KEY)
|
35 |
),
|
|
|
|
|
|
|
|
|
|
|
36 |
'protected' => array(
|
37 |
'title' => __('Password Protected', AAM_KEY),
|
38 |
'sub' => '<small>' . sprintf(__('Password: %s', AAM_KEY), '<b data-preview="frontend.password" id="post-password"></b>' ) . ' <a href="#" class="change-password" data-ref="frontend.password" data-preview-id="post-password">' . __('change', AAM_KEY) . '</a></small>',
|
33 |
'title' => __('Comment', AAM_KEY),
|
34 |
'descr' => __('Restrict access to comment on %s if commenting feature is enabled.', AAM_KEY)
|
35 |
),
|
36 |
+
'redirect' => array(
|
37 |
+
'title' => __('Redirect', AAM_KEY),
|
38 |
+
'sub' => '<small>' . sprintf(__('Redirect to: %s', AAM_KEY), '<b data-preview="frontend.location" id="post-location"></b>' ) . ' <a href="#" class="change-location" data-ref="frontend.location" data-preview-id="post-location">' . __('change', AAM_KEY) . '</a></small>',
|
39 |
+
'descr' => __('Redirect to specified location when user tries to read the %s.', AAM_KEY)
|
40 |
+
),
|
41 |
'protected' => array(
|
42 |
'title' => __('Password Protected', AAM_KEY),
|
43 |
'sub' => '<small>' . sprintf(__('Password: %s', AAM_KEY), '<b data-preview="frontend.password" id="post-password"></b>' ) . ' <a href="#" class="change-password" data-ref="frontend.password" data-preview-id="post-password">' . __('change', AAM_KEY) . '</a></small>',
|
Application/Backend/phtml/index.phtml
CHANGED
@@ -49,31 +49,6 @@
|
|
49 |
</div>
|
50 |
<?php } ?>
|
51 |
|
52 |
-
<div class="metabox-holder">
|
53 |
-
<div class="postbox">
|
54 |
-
<div class="inside">
|
55 |
-
<div class="aam-social">
|
56 |
-
<a href="https://aamplugin.com/help" title="Help" target="_blank">
|
57 |
-
<i class="icon-help-circled"></i>
|
58 |
-
<span>Help</span>
|
59 |
-
</a>
|
60 |
-
<a target="_blank" href="https://twitter.com/aamplugin">
|
61 |
-
<i class="icon-twitter"></i>
|
62 |
-
<span>Twitter</span>
|
63 |
-
</a>
|
64 |
-
<a target="_blank" href="https://aamplugin.com">
|
65 |
-
<i class="icon-home"></i>
|
66 |
-
<span>Website</span>
|
67 |
-
</a>
|
68 |
-
<a target="_blank" href="mailto:support@aamplugin.com">
|
69 |
-
<i class="icon-mail-alt"></i>
|
70 |
-
<span>Email</span>
|
71 |
-
</a>
|
72 |
-
</div>
|
73 |
-
</div>
|
74 |
-
</div>
|
75 |
-
</div>
|
76 |
-
|
77 |
<?php if (is_network_admin() && !defined('AAM_MULTISITE')) { ?>
|
78 |
<div class="metabox-holder">
|
79 |
<div class="postbox">
|
@@ -87,10 +62,10 @@
|
|
87 |
</div>
|
88 |
</div>
|
89 |
<?php } ?>
|
|
|
|
|
90 |
|
91 |
<div class="metabox-holder">
|
92 |
-
<?php do_action('aam-sidebar-ui-action', 'top'); ?>
|
93 |
-
|
94 |
<div class="postbox">
|
95 |
<h3 class="hndle">
|
96 |
<span><?php echo __('Users/Roles Panel', AAM_KEY); ?></span>
|
@@ -236,8 +211,46 @@
|
|
236 |
</div>
|
237 |
</div>
|
238 |
</div>
|
239 |
-
<?php do_action('aam-sidebar-ui-action', 'bottom'); ?>
|
240 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
</div>
|
242 |
</div>
|
243 |
</div>
|
49 |
</div>
|
50 |
<?php } ?>
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
<?php if (is_network_admin() && !defined('AAM_MULTISITE')) { ?>
|
53 |
<div class="metabox-holder">
|
54 |
<div class="postbox">
|
62 |
</div>
|
63 |
</div>
|
64 |
<?php } ?>
|
65 |
+
|
66 |
+
<?php do_action('aam-sidebar-ui-action', 'top'); ?>
|
67 |
|
68 |
<div class="metabox-holder">
|
|
|
|
|
69 |
<div class="postbox">
|
70 |
<h3 class="hndle">
|
71 |
<span><?php echo __('Users/Roles Panel', AAM_KEY); ?></span>
|
211 |
</div>
|
212 |
</div>
|
213 |
</div>
|
|
|
214 |
</div>
|
215 |
+
|
216 |
+
<?php do_action('aam-sidebar-ui-action', 'bottom'); ?>
|
217 |
+
|
218 |
+
<div class="metabox-holder">
|
219 |
+
<div class="postbox">
|
220 |
+
<div class="inside">
|
221 |
+
<div class="aam-social">
|
222 |
+
<a href="https://aamplugin.com/help" title="Help" target="_blank">
|
223 |
+
<i class="icon-help-circled"></i>
|
224 |
+
<span>Help</span>
|
225 |
+
</a>
|
226 |
+
<a href="https://wordpress.org/support/plugin/advanced-access-manager/reviews/" title="Rate Me" target="_blank">
|
227 |
+
<i class="icon-star"></i>
|
228 |
+
<span>Rate Me</span>
|
229 |
+
</a>
|
230 |
+
<a target="_blank" href="https://twitter.com/aamplugin">
|
231 |
+
<i class="icon-twitter"></i>
|
232 |
+
<span>Twitter</span>
|
233 |
+
</a>
|
234 |
+
<a target="_blank" href="https://aamplugin.com">
|
235 |
+
<i class="icon-home"></i>
|
236 |
+
<span>Website</span>
|
237 |
+
</a>
|
238 |
+
<a target="_blank" href="mailto:support@aamplugin.com">
|
239 |
+
<i class="icon-mail-alt"></i>
|
240 |
+
<span>Email</span>
|
241 |
+
</a>
|
242 |
+
</div>
|
243 |
+
|
244 |
+
<hr/>
|
245 |
+
|
246 |
+
<div class="text-center">
|
247 |
+
<p class="aam-promo">Need for professional developer?</p>
|
248 |
+
<a href="http://dev.vasyltech/hire-developer" class="btn btn-primary" target="_blank">Get in touch today</a>
|
249 |
+
</div>
|
250 |
+
</div>
|
251 |
+
</div>
|
252 |
+
</div>
|
253 |
+
|
254 |
</div>
|
255 |
</div>
|
256 |
</div>
|
Application/Backend/phtml/object/post.phtml
CHANGED
@@ -123,7 +123,7 @@
|
|
123 |
</div>
|
124 |
<div class="modal-body">
|
125 |
<div class="form-group">
|
126 |
-
<label
|
127 |
<input type="text" class="form-control" id="password-value" placeholder="<?php echo __('Enter Password', AAM_KEY); ?>" />
|
128 |
</div>
|
129 |
</div>
|
@@ -134,5 +134,26 @@
|
|
134 |
</div>
|
135 |
</div>
|
136 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
</div>
|
138 |
<?php }
|
123 |
</div>
|
124 |
<div class="modal-body">
|
125 |
<div class="form-group">
|
126 |
+
<label><?php echo __('Password', AAM_KEY); ?></label>
|
127 |
<input type="text" class="form-control" id="password-value" placeholder="<?php echo __('Enter Password', AAM_KEY); ?>" />
|
128 |
</div>
|
129 |
</div>
|
134 |
</div>
|
135 |
</div>
|
136 |
</div>
|
137 |
+
|
138 |
+
<div class="modal fade" id="location-modal" tabindex="-1" role="dialog">
|
139 |
+
<div class="modal-dialog" role="document">
|
140 |
+
<div class="modal-content">
|
141 |
+
<div class="modal-header">
|
142 |
+
<button type="button" class="close" data-dismiss="modal" aria-label="<?php echo __('Close', AAM_KEY); ?>"><span aria-hidden="true">×</span></button>
|
143 |
+
<h4 class="modal-title"><?php echo __('Redirect', AAM_KEY); ?></h4>
|
144 |
+
</div>
|
145 |
+
<div class="modal-body">
|
146 |
+
<div class="form-group">
|
147 |
+
<label><?php echo __('Valid URL or Page ID', AAM_KEY); ?></label>
|
148 |
+
<input type="text" class="form-control" id="location-value" placeholder="<?php echo __('Enter Redirect', AAM_KEY); ?>" />
|
149 |
+
</div>
|
150 |
+
</div>
|
151 |
+
<div class="modal-footer">
|
152 |
+
<button type="button" class="btn btn-success" id="change-location-btn"><?php echo __('Change', AAM_KEY); ?></button>
|
153 |
+
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Close', AAM_KEY); ?></button>
|
154 |
+
</div>
|
155 |
+
</div>
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
</div>
|
159 |
<?php }
|
Application/Backend/phtml/object/redirect.phtml
CHANGED
@@ -91,6 +91,10 @@
|
|
91 |
<input type="radio" name="backend.redirect.type" id="backend-redirect-message" data-action="#backend-message" value="message" data-group="backend-redirect"<?php echo ($backendType == 'message' ? ' checked' : ''); ?> />
|
92 |
<label for="backend-redirect-message"><?php echo AAM_Backend_View_Helper::preparePhrase('Show customized message [(plain text or HTML)]', 'small'); ?></label>
|
93 |
</div>
|
|
|
|
|
|
|
|
|
94 |
<div class="radio">
|
95 |
<input type="radio" name="backend.redirect.type" id="backend-redirect-url" data-action="#backend-url" value="url" data-group="backend-redirect"<?php echo ($backendType == 'url' ? ' checked' : ''); ?> />
|
96 |
<label for="backend-redirect-url"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirected to the URL [(enter valid URL starting from http or https)]', 'small'); ?></label>
|
@@ -104,11 +108,27 @@
|
|
104 |
<label for="backend-message"><?php echo __('Customized Message', AAM_KEY); ?></label>
|
105 |
<textarea class="form-control" rows="3" placeholder="<?php echo __('Enter message...', AAM_KEY); ?>" name="backend.redirect.message"><?php echo $this->getOption('backend.redirect.message'); ?></textarea>
|
106 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
<div class="form-group aam-redirect-action backend-redirect" id="backend-url" style="display: <?php echo ($backendType == 'url' ? 'block' : 'none'); ?>;">
|
109 |
<label for="backend-url"><?php echo __('The URL', AAM_KEY); ?></label>
|
110 |
<input type="text" class="form-control" placeholder="http://" name="backend.redirect.url" value="<?php echo $this->getOption('backend.redirect.url'); ?>" />
|
111 |
</div>
|
|
|
112 |
<div class="form-group aam-redirect-action backend-redirect" id="backend-callback-action" style="display: <?php echo ($backendType == 'callback' ? 'block' : 'none'); ?>;">
|
113 |
<label for="frontend-url"><?php echo __('PHP Callback Function', AAM_KEY); ?></label>
|
114 |
<input type="text" class="form-control" placeholder="Enter valid callback" name="backend.redirect.callback" value="<?php echo $this->getOption('backend.redirect.callback'); ?>" />
|
91 |
<input type="radio" name="backend.redirect.type" id="backend-redirect-message" data-action="#backend-message" value="message" data-group="backend-redirect"<?php echo ($backendType == 'message' ? ' checked' : ''); ?> />
|
92 |
<label for="backend-redirect-message"><?php echo AAM_Backend_View_Helper::preparePhrase('Show customized message [(plain text or HTML)]', 'small'); ?></label>
|
93 |
</div>
|
94 |
+
<div class="radio">
|
95 |
+
<input type="radio" name="backend.redirect.type" id="backend-redirect-page" data-action="#backend-page-action" value="page" data-group="backend-redirect"<?php echo ($backendType == 'page' ? ' checked' : ''); ?> />
|
96 |
+
<label for="backend-redirect-page"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirected to existing frontend page [(select from the drop-down)]', 'small'); ?></label>
|
97 |
+
</div>
|
98 |
<div class="radio">
|
99 |
<input type="radio" name="backend.redirect.type" id="backend-redirect-url" data-action="#backend-url" value="url" data-group="backend-redirect"<?php echo ($backendType == 'url' ? ' checked' : ''); ?> />
|
100 |
<label for="backend-redirect-url"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirected to the URL [(enter valid URL starting from http or https)]', 'small'); ?></label>
|
108 |
<label for="backend-message"><?php echo __('Customized Message', AAM_KEY); ?></label>
|
109 |
<textarea class="form-control" rows="3" placeholder="<?php echo __('Enter message...', AAM_KEY); ?>" name="backend.redirect.message"><?php echo $this->getOption('backend.redirect.message'); ?></textarea>
|
110 |
</div>
|
111 |
+
|
112 |
+
<div class="form-group aam-redirect-action backend-redirect" id="backend-page-action" style="display: <?php echo ($backendType == 'page' ? 'block' : 'none'); ?>;">
|
113 |
+
<label for="backend-page"><?php echo __('Existing Page', AAM_KEY); ?></label>
|
114 |
+
<?php
|
115 |
+
wp_dropdown_pages(array(
|
116 |
+
'depth' => 99,
|
117 |
+
'selected' => $this->getOption('backend.redirect.page'),
|
118 |
+
'echo' => 1,
|
119 |
+
'name' => 'backend.redirect.page',
|
120 |
+
'id' => 'backend-page', // string
|
121 |
+
'class' => 'form-control', // string
|
122 |
+
'show_option_none' => __('-- Select Page --', AAM_KEY) // string
|
123 |
+
));
|
124 |
+
?>
|
125 |
+
</div>
|
126 |
|
127 |
<div class="form-group aam-redirect-action backend-redirect" id="backend-url" style="display: <?php echo ($backendType == 'url' ? 'block' : 'none'); ?>;">
|
128 |
<label for="backend-url"><?php echo __('The URL', AAM_KEY); ?></label>
|
129 |
<input type="text" class="form-control" placeholder="http://" name="backend.redirect.url" value="<?php echo $this->getOption('backend.redirect.url'); ?>" />
|
130 |
</div>
|
131 |
+
|
132 |
<div class="form-group aam-redirect-action backend-redirect" id="backend-callback-action" style="display: <?php echo ($backendType == 'callback' ? 'block' : 'none'); ?>;">
|
133 |
<label for="frontend-url"><?php echo __('PHP Callback Function', AAM_KEY); ?></label>
|
134 |
<input type="text" class="form-control" placeholder="Enter valid callback" name="backend.redirect.callback" value="<?php echo $this->getOption('backend.redirect.callback'); ?>" />
|
Application/Core/Cache.php
CHANGED
@@ -96,6 +96,8 @@ class AAM_Core_Cache {
|
|
96 |
$mquery = "DELETE FROM {$wpdb->usermeta} WHERE `meta_key` = %s";
|
97 |
$wpdb->query($wpdb->prepare($mquery, $wpdb->prefix . 'aam_cache' ));
|
98 |
|
|
|
|
|
99 |
//clear updated flag
|
100 |
self::$updated = false;
|
101 |
}
|
96 |
$mquery = "DELETE FROM {$wpdb->usermeta} WHERE `meta_key` = %s";
|
97 |
$wpdb->query($wpdb->prepare($mquery, $wpdb->prefix . 'aam_cache' ));
|
98 |
|
99 |
+
self::$cache = false;
|
100 |
+
|
101 |
//clear updated flag
|
102 |
self::$updated = false;
|
103 |
}
|
Application/Extension/Server.php
CHANGED
@@ -105,10 +105,18 @@ final class AAM_Extension_Server {
|
|
105 |
$params['uid'] = AAM_Core_API::getOption('aam-uid', null, 'site');
|
106 |
|
107 |
$response = AAM_Core_API::cURL($request, false, $params);
|
|
|
108 |
if (!is_wp_error($response)) {
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
}
|
114 |
|
105 |
$params['uid'] = AAM_Core_API::getOption('aam-uid', null, 'site');
|
106 |
|
107 |
$response = AAM_Core_API::cURL($request, false, $params);
|
108 |
+
|
109 |
if (!is_wp_error($response)) {
|
110 |
+
if ($response['response']['code'] == 200) {
|
111 |
+
$response = json_decode($response['body']);
|
112 |
+
if (empty($params['uid']) && isset($response->uid)) {
|
113 |
+
AAM_Core_API::updateOption('aam-uid', $response->uid, 'site');
|
114 |
+
}
|
115 |
+
} else {
|
116 |
+
$response = new WP_Error(
|
117 |
+
$response['response']['code'],
|
118 |
+
$response['response']['message'] . ':' . $response['body']
|
119 |
+
);
|
120 |
}
|
121 |
}
|
122 |
|
Application/Frontend/Manager.php
CHANGED
@@ -353,7 +353,13 @@ class AAM_Frontend_Manager {
|
|
353 |
array('object' => $object, 'action' => 'frontend.read')
|
354 |
);
|
355 |
}
|
356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
do_action('aam-wp-action', $object);
|
358 |
}
|
359 |
|
@@ -473,9 +479,10 @@ class AAM_Frontend_Manager {
|
|
473 |
public function preparePostQuery($query) {
|
474 |
if ($this->skip === false) {
|
475 |
$filtered = array();
|
476 |
-
|
477 |
-
|
478 |
-
|
|
|
479 |
} else {
|
480 |
foreach ($this->fetchPosts($query) as $id) {
|
481 |
$object = AAM::getUser()->getObject('post', $id);
|
@@ -486,8 +493,9 @@ class AAM_Frontend_Manager {
|
|
486 |
$filtered[] = $id;
|
487 |
}
|
488 |
}
|
489 |
-
AAM_Core_Cache::set(AAM::getUser(),
|
490 |
}
|
|
|
491 |
if (isset($query->query_vars['post__not_in'])) {
|
492 |
$query->query_vars['post__not_in'] = array_merge(
|
493 |
$query->query_vars['post__not_in'], $filtered
|
@@ -506,16 +514,8 @@ class AAM_Frontend_Manager {
|
|
506 |
protected function fetchPosts($query) {
|
507 |
$this->skip = true;
|
508 |
|
509 |
-
if (!empty($query->query['post_type'])) {
|
510 |
-
$postType = $query->query['post_type'];
|
511 |
-
} elseif (!empty($query->query_vars['post_type'])) {
|
512 |
-
$postType = $query->query_vars['post_type'];
|
513 |
-
} else {
|
514 |
-
$postType = 'post';
|
515 |
-
}
|
516 |
-
|
517 |
$posts = get_posts(array(
|
518 |
-
'post_type' => (
|
519 |
'numberposts' => -1,
|
520 |
'fields' => 'ids'
|
521 |
));
|
@@ -525,6 +525,23 @@ class AAM_Frontend_Manager {
|
|
525 |
return $posts;
|
526 |
}
|
527 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
/**
|
529 |
*
|
530 |
* @global WP_Post $post
|
353 |
array('object' => $object, 'action' => 'frontend.read')
|
354 |
);
|
355 |
}
|
356 |
+
|
357 |
+
//check post redirect
|
358 |
+
if ($object->has('frontend.redirect')) {
|
359 |
+
AAM_Core_API::redirect($object->get('frontend.location'));
|
360 |
+
}
|
361 |
+
|
362 |
+
//trigger any action
|
363 |
do_action('aam-wp-action', $object);
|
364 |
}
|
365 |
|
479 |
public function preparePostQuery($query) {
|
480 |
if ($this->skip === false) {
|
481 |
$filtered = array();
|
482 |
+
$key = $this->getQueryType($query) . '__not_in_frontend';
|
483 |
+
|
484 |
+
if (AAM_Core_Cache::has($key)) {
|
485 |
+
$filtered = AAM_Core_Cache::get($key);
|
486 |
} else {
|
487 |
foreach ($this->fetchPosts($query) as $id) {
|
488 |
$object = AAM::getUser()->getObject('post', $id);
|
493 |
$filtered[] = $id;
|
494 |
}
|
495 |
}
|
496 |
+
AAM_Core_Cache::set(AAM::getUser(), $key, $filtered);
|
497 |
}
|
498 |
+
|
499 |
if (isset($query->query_vars['post__not_in'])) {
|
500 |
$query->query_vars['post__not_in'] = array_merge(
|
501 |
$query->query_vars['post__not_in'], $filtered
|
514 |
protected function fetchPosts($query) {
|
515 |
$this->skip = true;
|
516 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
$posts = get_posts(array(
|
518 |
+
'post_type' => $this->getQueryType($query),
|
519 |
'numberposts' => -1,
|
520 |
'fields' => 'ids'
|
521 |
));
|
525 |
return $posts;
|
526 |
}
|
527 |
|
528 |
+
/**
|
529 |
+
*
|
530 |
+
* @param type $query
|
531 |
+
* @return type
|
532 |
+
*/
|
533 |
+
protected function getQueryType($query) {
|
534 |
+
if (!empty($query->query['post_type'])) {
|
535 |
+
$postType = $query->query['post_type'];
|
536 |
+
} elseif (!empty($query->query_vars['post_type'])) {
|
537 |
+
$postType = $query->query_vars['post_type'];
|
538 |
+
} else {
|
539 |
+
$postType = 'post';
|
540 |
+
}
|
541 |
+
|
542 |
+
return (is_string($postType) ? $postType : 'post');
|
543 |
+
}
|
544 |
+
|
545 |
/**
|
546 |
*
|
547 |
* @global WP_Post $post
|
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.
|
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.2
|
7 |
Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
Author URI: https://www.vasyltech.com
|
9 |
|
media/css/aam.css
CHANGED
@@ -1010,6 +1010,11 @@ input[type=radio]:checked + label:before {
|
|
1010 |
color: #777777;
|
1011 |
}
|
1012 |
|
|
|
|
|
|
|
|
|
|
|
1013 |
/* COVER KNOWN CSS ISSUES CASED BY OTHER PLUGINS OR THEMES */
|
1014 |
|
1015 |
/* Bridge theme */
|
1010 |
color: #777777;
|
1011 |
}
|
1012 |
|
1013 |
+
.aam-promo {
|
1014 |
+
font-size: 1.1em;
|
1015 |
+
letter-spacing: 1px;
|
1016 |
+
}
|
1017 |
+
|
1018 |
/* COVER KNOWN CSS ISSUES CASED BY OTHER PLUGINS OR THEMES */
|
1019 |
|
1020 |
/* Bridge theme */
|
media/js/aam-ui.js
CHANGED
@@ -553,8 +553,8 @@
|
|
553 |
|
554 |
//add subtitle
|
555 |
$('td:eq(0)', row).append(
|
556 |
-
$('<i/>', {'class': 'aam-row-subtitle'}).
|
557 |
-
aam.__('Role') + ': ' + data[1]
|
558 |
)
|
559 |
);
|
560 |
|
@@ -1349,7 +1349,8 @@
|
|
1349 |
for (var property in response.access) {
|
1350 |
var checked = (parseInt(response.access[property]) ? 'text-danger icon-check' : 'text-muted icon-check-empty');
|
1351 |
var checkbox = $('[data-property="' + property + '"]', container);
|
1352 |
-
|
|
|
1353 |
if (checkbox.length) {
|
1354 |
checkbox.attr({
|
1355 |
'class': 'aam-row-action ' + checked
|
@@ -1371,7 +1372,7 @@
|
|
1371 |
});
|
1372 |
}
|
1373 |
|
1374 |
-
$('#change-password-btn').attr({
|
1375 |
'data-type': object,
|
1376 |
'data-id': id
|
1377 |
});
|
@@ -1657,7 +1658,7 @@
|
|
1657 |
$(this).bind('click', function() {
|
1658 |
var password = $('#' + $(this).attr('data-preview-id')).text();
|
1659 |
|
1660 |
-
if (password !== '
|
1661 |
$('#post-password').val(password);
|
1662 |
} else {
|
1663 |
$('#post-password').val('');
|
@@ -1683,11 +1684,48 @@
|
|
1683 |
|
1684 |
if (response.status === 'success') {
|
1685 |
$('#' + $(this).attr('data-preview-id')).html(
|
1686 |
-
password ? password : '
|
1687 |
);
|
1688 |
}
|
1689 |
$('#password-modal').modal('hide');
|
1690 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1691 |
}
|
1692 |
|
1693 |
aam.addHook('init', initialize);
|
553 |
|
554 |
//add subtitle
|
555 |
$('td:eq(0)', row).append(
|
556 |
+
$('<i/>', {'class': 'aam-row-subtitle'}).html(
|
557 |
+
aam.__('Role') + ': ' + data[1] + '; ID: <b>' + data[0] + '</b>'
|
558 |
)
|
559 |
);
|
560 |
|
1349 |
for (var property in response.access) {
|
1350 |
var checked = (parseInt(response.access[property]) ? 'text-danger icon-check' : 'text-muted icon-check-empty');
|
1351 |
var checkbox = $('[data-property="' + property + '"]', container);
|
1352 |
+
console.log(checkbox.length);
|
1353 |
+
console.log('[data-preview="' + property + '"]: ' + $('[data-preview="' + property + '"]', container).length);
|
1354 |
if (checkbox.length) {
|
1355 |
checkbox.attr({
|
1356 |
'class': 'aam-row-action ' + checked
|
1372 |
});
|
1373 |
}
|
1374 |
|
1375 |
+
$('#change-password-btn,#change-location-btn').attr({
|
1376 |
'data-type': object,
|
1377 |
'data-id': id
|
1378 |
});
|
1658 |
$(this).bind('click', function() {
|
1659 |
var password = $('#' + $(this).attr('data-preview-id')).text();
|
1660 |
|
1661 |
+
if (password !== '') {
|
1662 |
$('#post-password').val(password);
|
1663 |
} else {
|
1664 |
$('#post-password').val('');
|
1684 |
|
1685 |
if (response.status === 'success') {
|
1686 |
$('#' + $(this).attr('data-preview-id')).html(
|
1687 |
+
password ? password : ''
|
1688 |
);
|
1689 |
}
|
1690 |
$('#password-modal').modal('hide');
|
1691 |
});
|
1692 |
+
|
1693 |
+
$('.change-location').each(function() {
|
1694 |
+
$(this).bind('click', function() {
|
1695 |
+
var location = $('#' + $(this).attr('data-preview-id')).text();
|
1696 |
+
|
1697 |
+
if (location !== '') {
|
1698 |
+
$('#post-location').val(location);
|
1699 |
+
} else {
|
1700 |
+
$('#post-location').val('');
|
1701 |
+
}
|
1702 |
+
|
1703 |
+
$('#change-location-btn').attr({
|
1704 |
+
'data-ref': $(this).attr('data-ref'),
|
1705 |
+
'data-preview-id': $(this).attr('data-preview-id')
|
1706 |
+
});
|
1707 |
+
|
1708 |
+
$('#location-modal').modal('show');
|
1709 |
+
});
|
1710 |
+
});
|
1711 |
+
|
1712 |
+
$('#change-location-btn').bind('click', function() {
|
1713 |
+
var redirect = $('#location-value').val();
|
1714 |
+
var response = save(
|
1715 |
+
$(this).attr('data-ref'),
|
1716 |
+
redirect,
|
1717 |
+
$(this).attr('data-type'),
|
1718 |
+
$(this).attr('data-id')
|
1719 |
+
);
|
1720 |
+
|
1721 |
+
if (response.status === 'success') {
|
1722 |
+
$('#' + $(this).attr('data-preview-id')).html(
|
1723 |
+
redirect ? redirect : ''
|
1724 |
+
);
|
1725 |
+
}
|
1726 |
+
$('#location-modal').modal('hide');
|
1727 |
+
});
|
1728 |
+
|
1729 |
}
|
1730 |
|
1731 |
aam.addHook('init', initialize);
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ 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
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 4.7.2
|
6 |
-
Stable tag: 4.
|
7 |
|
8 |
Manage your website access and security for any user, role or visitors.
|
9 |
|
@@ -19,6 +19,10 @@ Please note! Some features are limited or not included in the basic plugin insta
|
|
19 |
Upon activation refer to the Extensions tab to learn more about free and
|
20 |
premium extensions that are available for download.
|
21 |
|
|
|
|
|
|
|
|
|
22 |
= Manage Backend Menu =
|
23 |
Manage access to the backend menu for any user or group or users (roles).
|
24 |
|
@@ -43,10 +47,6 @@ For more information about this feature check [How to manage access to WordPress
|
|
43 |
Define custom access denied or login redirects for any user or group of users. Redirect
|
44 |
user to any existing page, URL or specify your own PHP callback function to handle it.
|
45 |
|
46 |
-
= Backend Lockdown =
|
47 |
-
Restrict access to your website backend side for any user or role. For more information about this feature
|
48 |
-
refer to the [How to lockdown WordPress backend](https://aamplugin.com/help/how-to-lockdown-wordpress-backend)
|
49 |
-
|
50 |
= Content Teaser =
|
51 |
Create your own content teaser for any limited post, page or custom post type.
|
52 |
|
@@ -100,6 +100,13 @@ Check our [help page](https://aamplugin.com/help) to find out more about AAM.
|
|
100 |
|
101 |
== Changelog ==
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
= 4.1.1 =
|
104 |
* Fixed bug with Post & Pages UI
|
105 |
* Added ability to define default category for any role or user
|
3 |
Tags: access, role, user, capability, page access, post access, security, login redirect, brute force attack, double authentication, membership, backend lockdown, wp-admin
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 4.7.2
|
6 |
+
Stable tag: 4.2
|
7 |
|
8 |
Manage your website access and security for any user, role or visitors.
|
9 |
|
19 |
Upon activation refer to the Extensions tab to learn more about free and
|
20 |
premium extensions that are available for download.
|
21 |
|
22 |
+
= Backend Lockdown =
|
23 |
+
Restrict access to your website backend side for any user or role. For more information about this feature
|
24 |
+
refer to the [How to lockdown WordPress backend](https://aamplugin.com/help/how-to-lockdown-wordpress-backend)
|
25 |
+
|
26 |
= Manage Backend Menu =
|
27 |
Manage access to the backend menu for any user or group or users (roles).
|
28 |
|
47 |
Define custom access denied or login redirects for any user or group of users. Redirect
|
48 |
user to any existing page, URL or specify your own PHP callback function to handle it.
|
49 |
|
|
|
|
|
|
|
|
|
50 |
= Content Teaser =
|
51 |
Create your own content teaser for any limited post, page or custom post type.
|
52 |
|
100 |
|
101 |
== Changelog ==
|
102 |
|
103 |
+
= 4.2 =
|
104 |
+
* Fixed the bug with post list caching
|
105 |
+
* Fixed the bug with Manage Access button
|
106 |
+
* Added REDIRECT option to post access list
|
107 |
+
* Added redirect to existing page for Backend tab on Access Denied Redirect
|
108 |
+
* Improved caching mechanism
|
109 |
+
|
110 |
= 4.1.1 =
|
111 |
* Fixed bug with Post & Pages UI
|
112 |
* Added ability to define default category for any role or user
|