AUTO LOGOUT EXTENDED
自動ログアウト除外ユーザ設定を追加
This commit is contained in:
@@ -68,6 +68,9 @@ if ( ! class_exists( 'AL_EXT' ) ) {
|
||||
* @throws Exception
|
||||
*/
|
||||
public function can_logged_in_extend() {
|
||||
if ( $this->is_exclude_user() ) {
|
||||
return;
|
||||
}
|
||||
if ( isset( $_COOKIE[ al_ext_config::AL_EXT_TMP_COOKIE ] ) && is_user_logged_in() ) {
|
||||
$prev_time = new DateTime( date( 'Y-m-d H:i:s', $_COOKIE[ al_ext_config::AL_EXT_TMP_COOKIE ] ) );
|
||||
$current_time = new DateTime( date( 'Y-m-d H:i:s' ) );
|
||||
@@ -112,6 +115,20 @@ if ( ! class_exists( 'AL_EXT' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
//自動ログアウト除外ユーザ判定
|
||||
private function is_exclude_user(): bool {
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return false;
|
||||
}
|
||||
$excludes = get_option( '_al_ext' )['exclude_users'];
|
||||
$current_user_role = wp_get_current_user()->roles[0];
|
||||
if ( $excludes[ $current_user_role ] == '1' ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user