Kentico 10中待审批标签不显示禁用用户问题咨询
I’ve run into this exact issue before with Kentico 10’s user registration flow—let’s walk through the likely causes and fixes:
1. Misaligned User Status vs. Approval State
Kentico treats "disabled users" and "users pending approval" as distinct states, even if they overlap. When you enable Registration requires administrator's approval, the system expects new users to be marked with Pending approval status—not just disabled. If your custom web part only sets User.Enabled = false without updating the approval status, those users won’t show up in the Pending Approval tab.
2. Fix Your Custom Registration Web Part Code
You need to explicitly set both the disabled status and the pending approval flag in your registration logic. Here’s the key code snippet to add/verify:
// Get the new user object (replace with your existing user retrieval) UserInfo newUser = UserInfoProvider.GetUserInfo("newusername"); // Set both required states newUser.Enabled = false; newUser.UserSettings.ApprovalStatus = UserApprovalStatusEnum.Pending; // Save the changes UserInfoProvider.SetUserInfo(newUser);
Without setting ApprovalStatus = Pending, Kentico doesn’t recognize the user as needing admin review.
3. Verify User Approval Status Directly
To confirm the root cause:
- Go to the Users application in Kentico Admin
- Switch to the List view (not the Pending Approval tab)
- Add the Approval Status column to the grid (via the column selector)
- Look for your disabled users—if their approval status is
ApprovedorRejected, they won’t appear in the Pending tab.
4. Check for Conflicting Custom Code
If you have global event handlers (like UserInfo.TYPEINFO.Events.Insert.After or UserInfo.TYPEINFO.Events.Update.After), make sure they aren’t overwriting the approval status after your registration web part runs. It’s common for custom events to accidentally reset these values without realizing it.
Quick Test
Create a test user via your custom web part, then check their approval status in the list view. If it’s not set to Pending, that’s the problem—update your code to include the approval status setting, and the users will start showing up in the Pending Approval tab.
内容的提问来源于stack exchange,提问作者user10997800

