| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* WP Adminify has some hooks for developers. |
| 5 |
*/ |
| 6 |
if ( ! class_exists( 'WP_Adminify_Developer_Hooks' ) ) { |
| 7 |
|
| 8 |
/** |
| 9 |
* Developer friendly hooks. |
| 10 |
*/ |
| 11 |
class WP_Adminify_Developer_Hooks { |
| 12 |
|
| 13 |
|
| 14 |
/* |
| 15 |
* * * * * * * * * |
| 16 |
* Class constructor |
| 17 |
* * * * * * * * * */ |
| 18 |
public function __construct() { |
| 19 |
$this->_hooks(); |
| 20 |
} |
| 21 |
|
| 22 |
public function _hooks() { |
| 23 |
add_filter( 'wp_adminify_remember_me', [ $this, 'wp_adminify_remember_me_callback' ], 10, 1 ); |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* wp_adminify_remember_me_callback [turn off the remember me option from WordPress login form.] |
| 28 |
* |
| 29 |
* @param bolean $activate |
| 30 |
* @since 1.0.0 |
| 31 |
*/ |
| 32 |
public function wp_adminify_remember_me_callback( $activate ) { |
| 33 |
if ( ! $activate ) { |
| 34 |
return; |
| 35 |
} |
| 36 |
|
| 37 |
// Add the hook into the login_form |
| 38 |
add_action( 'login_form', [ $this, 'wp_adminify_login_form' ], 99 ); |
| 39 |
// Reset any attempt to set the remember option |
| 40 |
add_action( 'login_head', [ $this, 'unset_remember_me_option' ], 99 ); |
| 41 |
} |
| 42 |
|
| 43 |
function unset_remember_me_option() { |
| 44 |
|
| 45 |
// Remove the rememberme post value |
| 46 |
if ( isset( $_POST['rememberme'] ) ) { |
| 47 |
unset( $_POST['rememberme'] ); |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
function wp_adminify_login_form() { |
| 52 |
ob_start( [ $this, 'remove_forgetmenot_class' ] ); |
| 53 |
} |
| 54 |
|
| 55 |
function remove_forgetmenot_class( $content ) { |
| 56 |
$content = preg_replace( '/<p class="forgetmenot">(.*)<\/p>/', '', $content ); |
| 57 |
return $content; |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
|