| 1 |
<?php |
| 2 |
|
| 3 |
namespace Booktics\Admin; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 6 |
|
| 7 |
use Booktics\Contracts\Hookable_Service_Contract; |
| 8 |
use Booktics\Models\Team_Member_Model; |
| 9 |
|
| 10 |
/** |
| 11 |
* Handles team member password reset functionality |
| 12 |
* |
| 13 |
* @package Booktics\Admin |
| 14 |
*/ |
| 15 |
class Team_Member_Password_Reset implements Hookable_Service_Contract { |
| 16 |
|
| 17 |
/** |
| 18 |
* Register WordPress hooks |
| 19 |
* |
| 20 |
* @return void |
| 21 |
*/ |
| 22 |
public function register() { |
| 23 |
add_action( |
| 24 |
'password_reset', array( |
| 25 |
$this, |
| 26 |
'password_reset_action', |
| 27 |
), 10, 2 |
| 28 |
); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Handle password reset action for team members |
| 33 |
* |
| 34 |
* @param $user |
| 35 |
* @param $new_pass |
| 36 |
* |
| 37 |
* @return void |
| 38 |
*/ |
| 39 |
public function password_reset_action( $user, $new_pass ) { |
| 40 |
$team_member_id = $user->ID; |
| 41 |
$team_member = new Team_Member_Model( $team_member_id ); |
| 42 |
$team_member->update( array( 'status' => 'active' ) ); |
| 43 |
} |
| 44 |
} |
| 45 |
|