Hello, deleting all users by the method
UserController.DeleteUsers(int portalId, bool notify, bool deleteAdmin)
I ran into this error:
System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Entities.Users.UserController.UpdateUser(Int32 portalId, UserInfo user, Boolean loggedAction, Boolean sendNotification, Boolean clearCache) in C:\DNN\09.11.2\DNN Platform\Library\Entities\Users\UserController.cs:line 1917 at DotNetNuke.Entities.Users.UserController.UpdateUser(Int32 portalId, UserInfo user, Boolean loggedAction, Boolean sendNotification) in C:\DNN\09.11.2\DNN Platform\Library\Entities\Users\UserController.cs:line 1275 at DotNetNuke.Entities.Users.UserController.UpdateUser(Int32 portalId, UserInfo user, Boolean loggedAction) in C:\DNN\09.11.2\DNN Platform\Library\Entities\Users\UserController.cs:line 1265 at DotNetNuke.Entities.Users.UserController.UpdateUser(Int32 portalId, UserInfo user) in C:\DNN\09.11.2\DNN Platform\Library\Entities\Users\UserController.cs:line 1256 at DotNetNuke.Entities.Users.UserController.DeleteUser(UserInfo& user, Boolean notify, Boolean deleteAdmin) in C:\DNN\09.11.2\DNN Platform\Library\Entities\Users\UserController.cs:line 500 at DotNetNuke.Entities.Users.UserController.DeleteUsers(Int32 portalId, Boolean notify, Boolean deleteAdmin) in C:\DNN\09.11.2\DNN Platform\Library\Entities\Users\UserController.cs:line 514
UserInfo GetUserById(int portalId, int userId)
return NULL executing this line of code:
... user = MembershipProvider.Instance().GetUser(GetEffectivePortalId(portalId), userId); ...
I'm using AspNetMembershipProvider Scenario: I'm porting some modules developed for DNN 7.4 to DNN 9.11.2, and I noticed the call to
UpdateUser(portalId, GetUserById(portalId, user.UserID))
Any idea on how to get around the problem? Thanks S.
We have a module that deletes users, you can find the code here and it is working in DNN 9.11.2:
https://github.com/40fing...rsController.cs#L228
Posted By Daniel Valadas on 2/1/2024 2:13 PM I don't have a quick resolution, but curious if you have portal groups setup?
Hi Daniel, I've installed and configured only one portal, updating it from 7.4 using the recommended steps up to 9.11.2
Posted By Timo Breumelhof (40F) on 2/1/2024 5:20 PM We have a module that deletes users, you can find the code here and it is working in DNN 9.11.2: https://github.com/40fing...rsController.cs#L228
Hi Timo, I've seen you are using UserController's API...have you never tested the DeleteUsers? :-\
Posted By Daniel Valadas on 2/2/2024 3:13 AM If you join our discord and attend one of our co-coding sessions, happy to try to pinpoint it with you. Alternatively, if you can do a minimal module that makes this bug happen, you could create an issue with it at https://github.com/dnnsof.../Dnn.Platform/issues which would make it easy to test/fix.
Opened an issue on GitHub. Could you be more specific on "If you join our discord and attend one of our co-coding sessions, happy to try to pinpoint it with you." Thanks S.
Posted By Seek78 on 2/5/2024 1:39 PM Problem found, there is a trigger on the db that remove the record immediately :-| Is there a setting at portale level to do that? Thanks again
I am unaware of any triggers in the DNN database by default. So, this must have been added by someone.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.