views:

76

answers:

1

I have been asked to fix a Community Server forum where thousands of users were created via a script. All of their profile pages are SEOspam for prescription drugs, etc. The forum was not using email verification or admin approval for newly registered users. I turned on the latter for now, but captcha would be nice.

My problem is that it is very cumbersome to mass delete these accounts. I set up a .net grid (Telerik Radgrid actually) so that I could mass select users and click delete. However the following code does not seem to be working (mind the VB nubbery):

Protected Sub rgUsers_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgUsers.NeedDataSource
    rgUsers.DataSource = Users.GetUsers().Users()
End Sub

Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click
    For Each item As GridDataItem In rgUsers.SelectedItems
        Dim selectedUserID As Integer = item.OwnerTableView.DataKeyValues(item.ItemIndex)("UserID")
        Dim userToDelete As CommunityServer.Components.User = Users.GetUser(selectedUserID, False) ' User is definitely populated. '
        Dim username As String = userToDelete.Username
        Dim deleteStatus As DeleteUserStatus = Users.DeleteUser(User)
        Trace.Write(String.Format("Delete result for user {0}: {1}", username, deleteStatus.ToString)) ' Returns enum value 3 (Success.) '
    Next
    rgUsers.Rebind()
End Sub

The UserDeleteStatus result returns 'Success', however the user is not actually deleted. Am i using the correct delete function? Any help is greatly appreciated, as this is sort of time sensitive (the client is not in the market for penis enlargment pills.)

A: 

The issue was that the UserDeleteStatus was actually returning 'AuthenticationRequired'

Shawn Simon