Skip to content

Commit

Permalink
增加禁止非管理员进入资料页
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Jan 16, 2023
1 parent d066804 commit b0592e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions inc/fun/opt.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,3 +523,12 @@ function get_entry_content_class($echo=true){
}
return $class;
}

function pk_disable_not_admin_user_profile(){
if(is_admin() && !current_user_can('administrator')){
wp_die( '您无权访问' );
}
}
if(pk_is_checked('disable_not_admin_user_profile')){
add_action('load-profile.php', 'pk_disable_not_admin_user_profile');
}
6 changes: 6 additions & 0 deletions inc/setting/options/OptionGlobal.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ function get_fields(): array
'type' => 'switch',
'sdt' => 'false',
],
[
'id' => 'disable_not_admin_user_profile',
'label' => '禁止非管理员进入资料页',
'type' => 'switch',
'sdt' => false,
],
[
'id' => 'compress_html',
'label' => '将HTML压缩成一行',
Expand Down

0 comments on commit b0592e8

Please sign in to comment.