From f79712b549719483dfcc37b160fc4b6e15a10458 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Thu, 22 Jun 2023 12:57:43 +0300 Subject: [PATCH] - fix ajax_muted_action() --- includes/core/class-form.php | 37 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/includes/core/class-form.php b/includes/core/class-form.php index 4b4c60a3..fb390c00 100644 --- a/includes/core/class-form.php +++ b/includes/core/class-form.php @@ -70,18 +70,13 @@ if ( ! class_exists( 'um\core\Form' ) ) { public function ajax_muted_action() { UM()->check_ajax_nonce(); - /** - * @var $user_id - * @var $hook - */ - extract( $_REQUEST ); - - if ( isset( $user_id ) ) { - $user_id = absint( $user_id ); + // phpcs:disable WordPress.Security.NonceVerification + if ( isset( $_REQUEST['user_id'] ) ) { + $user_id = absint( $_REQUEST['user_id'] ); } - if ( isset( $hook ) ) { - $hook = sanitize_key( $hook ); + if ( isset( $_REQUEST['hook'] ) ) { + $hook = sanitize_key( $_REQUEST['hook'] ); } if ( ! UM()->roles()->um_current_user_can( 'edit', $user_id ) ) { @@ -91,27 +86,23 @@ if ( ! class_exists( 'um\core\Form' ) ) { switch ( $hook ) { default: /** - * UM hook + * Fires on AJAX muted action. * - * @type action - * @title um_run_ajax_function__{$hook} - * @description Action on AJAX muted action - * @input_vars - * [{"var":"$request","type":"int","desc":"Request"}] - * @change_log - * ["Since: 2.0"] - * @usage add_action( 'um_run_ajax_function__{$hook}', 'function_name', 10, 1 ); - * @example - * Make any custom action on AJAX muted action. * function my_run_ajax_function( $request ) { * // your code here * } - * ?> + * add_action( 'um_run_ajax_function__{$hook}', 'my_run_ajax_function', 10, 1 ); */ do_action( "um_run_ajax_function__{$hook}", $_REQUEST ); break; } + // phpcs:enable WordPress.Security.NonceVerification }