| 1 |
<?php |
| 2 |
/** |
| 3 |
* User admin handling. |
| 4 |
* |
| 5 |
* Handles all user admin operations. |
| 6 |
* |
| 7 |
* @package Features |
| 8 |
* @author Pierre Lannoy <https://pierre.lannoy.fr/>. |
| 9 |
* @since 1.0.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace POSessions\Plugin\Feature; |
| 13 |
use POSessions\System\Session; |
| 14 |
|
| 15 |
/** |
| 16 |
* Define the user admin functionality. |
| 17 |
* |
| 18 |
* Handles all user admin operations. |
| 19 |
* |
| 20 |
* @package Features |
| 21 |
* @author Pierre Lannoy <https://pierre.lannoy.fr/>. |
| 22 |
* @since 1.0.0 |
| 23 |
*/ |
| 24 |
class UserAdministration { |
| 25 |
|
| 26 |
/** |
| 27 |
* Initialize the meta class and set its properties. |
| 28 |
* |
| 29 |
* @since 1.0.0 |
| 30 |
*/ |
| 31 |
public static function init() { |
| 32 |
add_action( 'show_user_profile', [ self::class, 'user_profile' ], 0 ); |
| 33 |
add_action( 'edit_user_profile', [ self::class, 'user_profile' ], 0 ); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Echo the 'Sessions Management' section of the user profile. |
| 38 |
* |
| 39 |
* @param \WP_User $user The user. |
| 40 |
* @since 1.0.0 |
| 41 |
*/ |
| 42 |
public static function user_profile( $user ) { |
| 43 |
$session = new Session( $user ); |
| 44 |
if ( $session->is_needed() ) { |
| 45 |
include POSE_ADMIN_DIR . 'partials/sessions-admin-user-profile.php'; |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
} |