MC4WP_Admin::listen_for_actions PHP Method

listen_for_actions() public method

Listen for _mc4wp_action requests
public listen_for_actions ( )
    public function listen_for_actions()
    {
        // listen for any action (if user is authorised)
        if (!$this->tools->is_user_authorized() || !isset($_REQUEST['_mc4wp_action'])) {
            return false;
        }
        $action = (string) $_REQUEST['_mc4wp_action'];
        /**
         * Allows you to hook into requests containing `_mc4wp_action` => action name.
         *
         * The dynamic portion of the hook name, `$action`, refers to the action name.
         *
         * By the time this hook is fired, the user is already authorized. After processing all the registered hooks,
         * the request is redirected back to the referring URL.
         *
         * @since 3.0
         */
        do_action('mc4wp_admin_' . $action);
        // redirect back to where we came from
        $redirect_url = !empty($_POST['_redirect_to']) ? $_POST['_redirect_to'] : remove_query_arg('_mc4wp_action');
        wp_redirect($redirect_url);
        exit;
    }