进行了一些小优化
This commit is contained in:
@@ -32,7 +32,11 @@ function aksrt_get_user_notifications(int $user_id = 0): array {
|
||||
'status' => 'hold',
|
||||
]);
|
||||
|
||||
if ($pending_comments > 0 && (!class_exists('\AKSRT\Settings\Settings') || \AKSRT\Settings\Settings::notification_enabled('pending_comments'))) {
|
||||
if (
|
||||
$pending_comments > 0
|
||||
&& (!class_exists('\AKSRT\Settings\Settings') || \AKSRT\Settings\Settings::notification_enabled('pending_comments'))
|
||||
&& (!class_exists('\AKSRT\User\NotificationPreferences') || \AKSRT\User\NotificationPreferences::allows($user_id, 'pending_comments'))
|
||||
) {
|
||||
$items[] = [
|
||||
'type' => 'pending_comments',
|
||||
'title' => __('评论待审核', 'aksrt'),
|
||||
@@ -249,6 +253,9 @@ if (!function_exists('aksrt_add_user_notification')) :
|
||||
function aksrt_add_user_notification(int $user_id, array $payload): void {
|
||||
if ($user_id <= 0) return;
|
||||
$type = sanitize_key((string) ($payload['type'] ?? 'notice'));
|
||||
if (class_exists('\AKSRT\User\NotificationPreferences') && !\AKSRT\User\NotificationPreferences::allows($user_id, $type)) {
|
||||
return;
|
||||
}
|
||||
if (class_exists('\AKSRT\Settings\Settings') && !\AKSRT\Settings\Settings::notification_enabled($type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user