Server IP : 172.67.157.199 / Your IP : 3.17.179.193 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/plugins/ultimate-dashboard/modules/admin-menu/ajax/ |
Upload File : |
<?php /** * Get menu & submenu. * * @package Ultimate_Dashboard */ namespace Udb\AdminMenu\Ajax; defined( 'ABSPATH' ) || die( "Can't access directly" ); /** * Class to get menu & submenu. */ class Get_Users { /** * Get menu & submenu. */ public function ajax() { $nonce = isset( $_GET['nonce'] ) ? sanitize_text_field( $_GET['nonce'] ) : ''; if ( ! wp_verify_nonce( $nonce, 'udb_admin_menu_get_users' ) ) { wp_send_json_error( __( 'Invalid token', 'ultimate-dashboard' ) ); } $this->load_users(); } /** * Manually load menu & submenu. */ public function load_users() { $users = get_users(); $select2_data = array( array( 'id' => '', 'text' => __( 'Select a User', 'ultimate-dashboard' ), ), ); foreach ( $users as $user ) { array_push( $select2_data, array( 'id' => $user->ID, 'text' => $user->display_name, ) ); } wp_send_json_success( $select2_data ); } }