features
3 years ago
roles
3 years ago
admin-load.php
3 years ago
admin.php
3 years ago
backup-handler.php
4 years ago
backup.php
4 years ago
cap-helper.php
4 years ago
filters-admin.php
4 years ago
filters-woocommerce.php
4 years ago
filters-wp_rest_workarounds.php
4 years ago
filters.php
4 years ago
functions-admin.php
3 years ago
functions.php
4 years ago
handler.php
4 years ago
inflect-cme.php
4 years ago
manager.php
3 years ago
network.php
4 years ago
pp-handler.php
4 years ago
pp-ui.php
4 years ago
publishpress-roles.php
4 years ago
settings-handler.php
3 years ago
settings-ui.php
3 years ago
settings.php
3 years ago
settings-handler.php
28 lines
| 1 | <?php |
| 2 | /* |
| 3 | * PublishPress Capabilities [Free] |
| 4 | * |
| 5 | * Process updates to plugin settings |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | add_action('init', function() { |
| 10 | if (check_admin_referer('pp-capabilities-settings') && current_user_can('manage_capabilities')) { |
| 11 | if (!empty($_POST['all_options'])) { |
| 12 | foreach (array_map('sanitize_key', explode(',', sanitize_text_field($_POST['all_options']))) as $option_name) { |
| 13 | foreach (['cme_', 'capsman', 'pp_capabilities'] as $prefix) { |
| 14 | if (0 === strpos($option_name, $prefix)) { |
| 15 | $value = isset($_POST[$option_name]) ? sanitize_text_field($_POST[$option_name]) : ''; |
| 16 | |
| 17 | if (!is_array($value)) { |
| 18 | $value = trim($value); |
| 19 | } |
| 20 | |
| 21 | update_option($option_name, $value); |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | }); |
| 28 |