fix: 调试控制台仅对管理员可见

- argon_debug_console_footer_button() 添加管理员权限检查
- argon_debug_console_script() 添加管理员权限检查
This commit is contained in:
2026-01-16 00:26:28 +08:00
parent 6b7466f42b
commit 8885a85ce2

View File

@@ -578,6 +578,10 @@ function argon_debug_console_footer_button() {
if (get_option('argon_enable_debug_console', 'false') != 'true') { if (get_option('argon_enable_debug_console', 'false') != 'true') {
return; return;
} }
// 仅管理员可见
if (!current_user_can('manage_options')) {
return;
}
?> ?>
<div id="argon-debug-footer-btn" style="text-align:center;padding:12px 0;border-top:1px solid rgba(0,0,0,0.05);margin-top:15px;"> <div id="argon-debug-footer-btn" style="text-align:center;padding:12px 0;border-top:1px solid rgba(0,0,0,0.05);margin-top:15px;">
<button onclick="argonDebug.toggle()" style="background:transparent;border:1px solid var(--themecolor,#5e72e4);color:var(--themecolor,#5e72e4);padding:8px 20px;border-radius:20px;font-size:12px;cursor:pointer;display:inline-flex;align-items:center;gap:8px;transition:all .2s;"> <button onclick="argonDebug.toggle()" style="background:transparent;border:1px solid var(--themecolor,#5e72e4);color:var(--themecolor,#5e72e4);padding:8px 20px;border-radius:20px;font-size:12px;cursor:pointer;display:inline-flex;align-items:center;gap:8px;transition:all .2s;">
@@ -594,6 +598,10 @@ function argon_debug_console_script() {
if (get_option('argon_enable_debug_console', 'false') != 'true') { if (get_option('argon_enable_debug_console', 'false') != 'true') {
return; return;
} }
// 仅管理员可见
if (!current_user_can('manage_options')) {
return;
}
$is_admin = current_user_can('manage_options'); $is_admin = current_user_can('manage_options');
$muted_errors = argon_get_muted_errors(); $muted_errors = argon_get_muted_errors();