PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.3
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.3
6.0.3 6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 All 34 releases
← All changes | integrations/restrict-content-pro/includes/ajax-functions.php +48 -0 5.7.6 → 6.0.3 View file →
@@ -1,0 +1,48 @@
1 +<?php
2 +/**
3 + * Ajax Functions
4 + *
5 + * @package AutomatorWP\Restrict_Content_Pro\Ajax_Functions
6 + * @since 1.0.0
7 + */
8 +// Exit if accessed directly
9 +if( !defined( 'ABSPATH' ) ) exit;
10 +
11 +/**
12 + * Ajax function for selecting contents
13 + *
14 + * @since 1.0.0
15 + */
16 +function automatorwp_restrict_content_pro_ajax_get_memberships() {
17 + // Security check
18 + check_ajax_referer( 'automatorwp_admin', 'nonce' );
19 +
20 + // Permissions check
21 + if( ! current_user_can( automatorwp_get_manager_capability() ) ) {
22 + wp_send_json_error( __( 'You\'re not allowed to perform this action.', 'automatorwp' ) );
23 + }
24 +
25 + global $wpdb;
26 +
27 + // Pull back the search string
28 + $search = isset( $_REQUEST['q'] ) ? $wpdb->esc_like( $_REQUEST['q'] ) : '';
29 +
30 + $rcp_levels_table_name = rcp_get_levels_db_name();
31 +
32 + // Get the contents
33 + $results = $wpdb->get_results( $wpdb->prepare(
34 + "SELECT m.id AS id, m.name AS text
35 + FROM {$rcp_levels_table_name} AS m
36 + WHERE m.name LIKE %s",
37 + "%%{$search}%%"
38 + ) );
39 +
40 + // Prepend option none
41 + $results = automatorwp_ajax_get_ajax_results_option_none( $results );
42 +
43 + // Return our results
44 + wp_send_json_success( $results );
45 + die;
46 +
47 +}
48 +add_action( 'wp_ajax_automatorwp_restrict_content_pro_get_memberships', 'automatorwp_restrict_content_pro_ajax_get_memberships' );