Advanced Access Manager - Version 3.2.1

Version Description

  • Added show_screen_options capability support to control Screen Options Tab
  • Added show_help_tabs capability support to control Help Tabs
  • Added AAM Support
Download this release

Release Info

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

Code changes from version 3.2 to 3.2.1

Application/Backend/Capability.php CHANGED
@@ -132,13 +132,8 @@ class AAM_Backend_Capability {
132
  * @return type
133
  */
134
  protected function retrieveAllCaps() {
135
- $caps = $response = array();
136
-
137
- foreach (AAM_Core_API::getRoles()->role_objects as $role) {
138
- if (is_array($role->capabilities)) {
139
- $caps = array_merge($caps, $role->capabilities);
140
- }
141
- }
142
 
143
  foreach (array_keys($caps) as $cap) {
144
  $response[] = array(
132
  * @return type
133
  */
134
  protected function retrieveAllCaps() {
135
+ $response = array();
136
+ $caps = AAM_Core_API::getAllCapabilities();
 
 
 
 
 
137
 
138
  foreach (array_keys($caps) as $cap) {
139
  $response[] = array(
Application/Backend/Filter.php CHANGED
@@ -57,6 +57,10 @@ class AAM_Backend_Filter {
57
 
58
  //user profile update action
59
  add_action('profile_update', array($this, 'profileUpdate'));
 
 
 
 
60
  }
61
 
62
  /**
@@ -307,6 +311,47 @@ class AAM_Backend_Filter {
307
  do_action('aam-clear-cache-action', new AAM_Core_Subject_User($user_id));
308
  }
309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  /**
311
  * Restrict user capabilities
312
  *
57
 
58
  //user profile update action
59
  add_action('profile_update', array($this, 'profileUpdate'));
60
+
61
+ //screen options & contextual help hooks
62
+ add_filter('screen_options_show_screen', array($this, 'screenOptions'));
63
+ add_filter('contextual_help', array($this, 'helpOptions'), 10, 3);
64
  }
65
 
66
  /**
311
  do_action('aam-clear-cache-action', new AAM_Core_Subject_User($user_id));
312
  }
313
 
314
+ /**
315
+ *
316
+ * @param type $flag
317
+ * @return type
318
+ */
319
+ public function screenOptions($flag) {
320
+ //IMPORTANT!! Do not use AAM::getUser()->hasCapability because
321
+ //show_screen_options is custom capability and it may not be present for new
322
+ //website
323
+ $caps = AAM_Core_API::getAllCapabilities();
324
+
325
+ if (isset($caps['show_screen_options'])) {
326
+ $flag = AAM::getUser()->hasCapability('show_screen_options');
327
+ }
328
+
329
+ return $flag;
330
+ }
331
+
332
+ /**
333
+ *
334
+ * @param array $help
335
+ * @param type $id
336
+ * @param type $screen
337
+ * @return array
338
+ */
339
+ public function helpOptions($help, $id, $screen) {
340
+ //IMPORTANT!! Do not use AAM::getUser()->hasCapability because
341
+ //show_screen_options is custom capability and it may not be present for new
342
+ //website
343
+ $caps = AAM_Core_API::getAllCapabilities();
344
+
345
+ if (isset($caps['show_help_tabs'])) {
346
+ if (!AAM::getUser()->hasCapability('show_help_tabs')) {
347
+ $screen->remove_help_tabs();
348
+ $help = array();
349
+ }
350
+ }
351
+
352
+ return $help;
353
+ }
354
+
355
  /**
356
  * Restrict user capabilities
357
  *
Application/Backend/ProductList.php CHANGED
@@ -18,6 +18,16 @@ return array(
18
  'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FGAHULDEFZV4U',
19
  'status' => AAM_Core_Repository::getInstance()->extensionStatus('AAM Plus Package')
20
  ),
 
 
 
 
 
 
 
 
 
 
21
  array(
22
  'title' => 'AAM Role Filter',
23
  'id' => 'AAM Role Filter',
@@ -34,7 +44,7 @@ return array(
34
  'type' => 'commercial',
35
  'cost' => '$150',
36
  'currency' => 'USD',
37
- 'description' => __('Development license gives you an ability to download all the available extensions and use them to up to 5 life domains.', AAM_KEY),
38
  'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZX9RCWU6BTE52',
39
  'status' => AAM_Core_Repository::getInstance()->extensionStatus('AAM Development License')
40
  ),
18
  'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FGAHULDEFZV4U',
19
  'status' => AAM_Core_Repository::getInstance()->extensionStatus('AAM Plus Package')
20
  ),
21
+ array(
22
+ 'title' => 'AAM Support',
23
+ 'id' => 'AAM Support',
24
+ 'type' => 'commercial',
25
+ 'cost' => '$50',
26
+ 'currency' => 'USD',
27
+ 'description' => AAM_Backend_Helper::preparePhrase('Highest priority technical support (within 1 business day). Need help or not sure how to use AAM? We will carefully analyze your objectives, educate and help you to archive your goals with existing AAM functionality or we will put $50 toward custom development if necessary. [Otherwise money back guaranteed!]', 'strong'),
28
+ 'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZM8BAAN8CE3M4',
29
+ 'status' => 'download'
30
+ ),
31
  array(
32
  'title' => 'AAM Role Filter',
33
  'id' => 'AAM Role Filter',
44
  'type' => 'commercial',
45
  'cost' => '$150',
46
  'currency' => 'USD',
47
+ 'description' => __('Development license gives you an ability to download all the available extensions and use them up to 5 life domains.', AAM_KEY),
48
  'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZX9RCWU6BTE52',
49
  'status' => AAM_Core_Repository::getInstance()->extensionStatus('AAM Development License')
50
  ),
Application/Backend/view/index.phtml CHANGED
@@ -287,7 +287,7 @@
287
  </div>
288
  </div>
289
  <?php do_action('aam-sidebar-ui-action', 'bottom'); ?>
290
-
291
  <!-- Error Fix Promotion: begin -->
292
  <div class="postbox hidden" id="errorfix-promotion">
293
  <h3 class="hndle">
287
  </div>
288
  </div>
289
  <?php do_action('aam-sidebar-ui-action', 'bottom'); ?>
290
+
291
  <!-- Error Fix Promotion: begin -->
292
  <div class="postbox hidden" id="errorfix-promotion">
293
  <h3 class="hndle">
Application/Core/API.php CHANGED
@@ -160,6 +160,27 @@ final class AAM_Core_API {
160
 
161
  return max($levels);
162
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
  /**
165
  * Reject the request
@@ -170,8 +191,8 @@ final class AAM_Core_API {
170
  *
171
  * @access public
172
  */
173
- public static function reject() {
174
- $redirect = AAM_Core_ConfigPress::get('frontend.access.deny.redirect');
175
 
176
  if (filter_var($redirect, FILTER_VALIDATE_URL)) {
177
  wp_redirect($redirect);
@@ -179,7 +200,7 @@ final class AAM_Core_API {
179
  wp_redirect(get_post_permalink($redirect));
180
  } else {
181
  $message = AAM_Core_ConfigPress::get(
182
- 'frontend.access.deny.message', __('Access Denied', AAM_KEY)
183
  );
184
  wp_die($message);
185
  }
160
 
161
  return max($levels);
162
  }
163
+
164
+ /**
165
+ * Get all capabilities
166
+ *
167
+ * Prepare and return list of all registered in the system capabilities
168
+ *
169
+ * @return array
170
+ *
171
+ * @access public
172
+ */
173
+ public static function getAllCapabilities() {
174
+ $caps = array();
175
+
176
+ foreach (self::getRoles()->role_objects as $role) {
177
+ if (is_array($role->capabilities)) {
178
+ $caps = array_merge($caps, $role->capabilities);
179
+ }
180
+ }
181
+
182
+ return $caps;
183
+ }
184
 
185
  /**
186
  * Reject the request
191
  *
192
  * @access public
193
  */
194
+ public static function reject($area = 'frontend') {
195
+ $redirect = AAM_Core_ConfigPress::get("{$area}.access.deny.redirect");
196
 
197
  if (filter_var($redirect, FILTER_VALIDATE_URL)) {
198
  wp_redirect($redirect);
200
  wp_redirect(get_post_permalink($redirect));
201
  } else {
202
  $message = AAM_Core_ConfigPress::get(
203
+ "{$area}.access.deny.message", __('Access Denied', AAM_KEY)
204
  );
205
  wp_die($message);
206
  }
aam.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: Manage User and Role Access to WordPress Backend and Frontend.
6
- Version: 3.2
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: http://www.vasyltech.com
9
 
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: Manage User and Role Access to WordPress Backend and Frontend.
6
+ Version: 3.2.1
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: http://www.vasyltech.com
9
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: vasyltech
3
  Tags: access, access manager, role, user, capability, admin, page, post, widget
4
  Requires at least: 3.8
5
  Tested up to: 4.5.2
6
- Stable tag: 3.2
7
 
8
  One of the best tools in WordPress repository to manage access to your posts,
9
  pages, categories and backend area for users, roles and visitors.
@@ -25,7 +25,7 @@ AAM the main objectives are to control access to your:
25
  * comments;
26
 
27
  > AAM is very flexible and customizable plugin that is used by a lot of developers
28
- > around the globe to create secure and powerful WordPress solutions.
29
 
30
  Check our [website page](http://vasyltech.com/advanced-access-manager) to find
31
  out more about the Advanced Access Manager.
@@ -45,6 +45,11 @@ out more about the Advanced Access Manager.
45
 
46
  == Changelog ==
47
 
 
 
 
 
 
48
  = 3.2 =
49
  * Fixed minor bug reporetd by WP Error Fix
50
  * Extended core functionality to support filter by author for Plus Package
3
  Tags: access, access manager, role, user, capability, admin, page, post, widget
4
  Requires at least: 3.8
5
  Tested up to: 4.5.2
6
+ Stable tag: 3.2.1
7
 
8
  One of the best tools in WordPress repository to manage access to your posts,
9
  pages, categories and backend area for users, roles and visitors.
25
  * comments;
26
 
27
  > AAM is very flexible and customizable plugin that is used by a lot of developers
28
+ > around the world to create secure and powerful WordPress solutions.
29
 
30
  Check our [website page](http://vasyltech.com/advanced-access-manager) to find
31
  out more about the Advanced Access Manager.
45
 
46
  == Changelog ==
47
 
48
+ = 3.2.1 =
49
+ * Added show_screen_options capability support to control Screen Options Tab
50
+ * Added show_help_tabs capability support to control Help Tabs
51
+ * Added AAM Support
52
+
53
  = 3.2 =
54
  * Fixed minor bug reporetd by WP Error Fix
55
  * Extended core functionality to support filter by author for Plus Package