| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
if( ! class_exists( 'MywpDeveloperAbstractModule' ) ) { |
| 8 |
return false; |
| 9 |
} |
| 10 |
|
| 11 |
if ( ! class_exists( 'MywpDeveloperModuleCoreUser' ) ) : |
| 12 |
|
| 13 |
final class MywpDeveloperModuleCoreUser extends MywpDeveloperAbstractModule { |
| 14 |
|
| 15 |
static protected $id = 'core_user'; |
| 16 |
|
| 17 |
static protected $priority = 30; |
| 18 |
|
| 19 |
public static function mywp_debug_renders( $debug_renders ) { |
| 20 |
|
| 21 |
$debug_renders[ self::$id ] = array( |
| 22 |
'debug_type' => 'core', |
| 23 |
'title' => __( 'Current User' , 'my-wp' ), |
| 24 |
); |
| 25 |
|
| 26 |
return $debug_renders; |
| 27 |
|
| 28 |
} |
| 29 |
|
| 30 |
protected static function get_debug_lists() { |
| 31 |
|
| 32 |
$user_id = get_current_user_id(); |
| 33 |
|
| 34 |
$mywp_user = new MywpUser( $user_id ); |
| 35 |
|
| 36 |
$debug_lists = array( |
| 37 |
'is_user_logged_in()' => is_user_logged_in(), |
| 38 |
'get_current_user_id()' => $user_id, |
| 39 |
'user_role' => $mywp_user->get_user_role(), |
| 40 |
'user_roles' => $mywp_user->get_user_roles(), |
| 41 |
'user_capabilities' => $mywp_user->get_user_capabilities(), |
| 42 |
'user_data' => $mywp_user->get_user_data(), |
| 43 |
'is_super_admin()' => is_super_admin(), |
| 44 |
'get_user_locale()' => get_user_locale(), |
| 45 |
); |
| 46 |
|
| 47 |
return $debug_lists; |
| 48 |
|
| 49 |
} |
| 50 |
|
| 51 |
} |
| 52 |
|
| 53 |
MywpDeveloperModuleCoreUser::init(); |
| 54 |
|
| 55 |
endif; |
| 56 |
|