AUTO LOGOUT EXTENDED
自動ログアウト除外ユーザ設定を追加
This commit is contained in:
@@ -33,13 +33,13 @@ if ( ! class_exists( 'AL_EXT_SETTING' ) ) {
|
||||
update_option( '_al_ext', $update_option );
|
||||
include al_ext_config::AL_EXT_TEMPLATE_DIR . 'success.php';
|
||||
}
|
||||
|
||||
$opt = get_option( '_al_ext' );
|
||||
$al_ext_type = $this->set_al_ext_parameter( $opt, 'type', al_ext_config::AL_EXT_DEFAULT_LOGOUT_TYPE );
|
||||
$expire_date = $this->set_al_ext_parameter( $opt, 'expire_date', al_ext_config::AL_EXT_DEFAULT_EXPIRE_DATE );
|
||||
$force_logout = $this->set_al_ext_parameter( $opt, 'force_logout', al_ext_config::AL_EXT_DEFAULT_EXPIRE_TIME );
|
||||
$force_logout_url = $this->set_al_ext_parameter( $opt, 'force_logout_url', '' );
|
||||
$default_logout_url = al_ext_config::get_default_logout_url();
|
||||
$exclude_users = $this->create_exclude_user_data();
|
||||
include al_ext_config::AL_EXT_TEMPLATE_DIR . 'al_ext_form.php';
|
||||
}
|
||||
|
||||
@@ -51,6 +51,28 @@ if ( ! class_exists( 'AL_EXT_SETTING' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
private function create_exclude_user_data(): array {
|
||||
return array(
|
||||
'administrator' => '管理者',
|
||||
'editor' => '編集者',
|
||||
'author' => '投稿者',
|
||||
'contributor' => '寄稿者',
|
||||
'subscriber' => '購読者',
|
||||
);
|
||||
}
|
||||
|
||||
private function check_exclude_user( $user_role ) {
|
||||
$opt = get_option( '_al_ext' );
|
||||
if ( ! isset( $opt['exclude_users'] ) ) {
|
||||
return;
|
||||
}
|
||||
foreach ( $opt['exclude_users'] as $user => $role ) {
|
||||
if ( $user_role == $user ) {
|
||||
return $role;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user