Welcome Guest! To enable all features please Login or Register.
Options
View
Go to last post Go to first unread
Offline BWG  
#1 Posted : Friday, May 11, 2018 7:06:48 AM(UTC)
BWG


Rank: YAF Lover

Reputation:

Joined: 1/19/2010(UTC)
Posts: 65

Thanks: 7 times
Was thanked: 2 time(s) in 2 post(s)
Hi,

Is there a way of removing users in bulk from YAF 2.2.0? What I want to do is delete all user accounts that have been inactive (not visited the forum) for more than X months.

Thanks

BWG
Sponsor
Offline tha_watcha  
#2 Posted : Friday, May 11, 2018 4:43:57 PM(UTC)
tha_watcha


Rank: YAF.NET Project Lead

Reputation:

Medals: Medal of Honor: Portal Puzzle Master: Portal Puzzle Master for DNNMedal of Honor Key: Given to pillars of the community who are key players in the YAF community and project.DNN Master: DNN Module ManBug Killer Medal of Honor: Medal for being a kick-ass bug killer!Medal of Honor for the Support King: Support King! Amazing asset to the YAF.NET Community.

Joined: 3/6/2010(UTC)
Posts: 3,832
Germany

Thanks: 70 times
Was thanked: 1174 time(s) in 1004 post(s)
The only way would be to do it directly via sql

Code:

  declare @UserID int

  declare userID cursor for
            select UserID from	[{databaseOwner}].[{objectQualifier}User]
WHERE DATEDIFF(YEAR, LastVisit, GetDate()) >= 5

        open userID

        fetch next from userID into @UserID
        while @@FETCH_STATUS = 0
        begin
            EXEC [{databaseOwner}].[{objectQualifier}user_delete] @UserID
			

            fetch next from userID into @UserID
        end
        close userID
        deallocate userID


this would delete all users that last visit the forum 5 years ago
thanks 1 user thanked tha_watcha for this useful post.
BWG on 5/12/2018(UTC)
Offline BWG  
#3 Posted : Saturday, May 12, 2018 6:20:03 AM(UTC)
BWG


Rank: YAF Lover

Reputation:

Joined: 1/19/2010(UTC)
Posts: 65

Thanks: 7 times
Was thanked: 2 time(s) in 2 post(s)
Many thanks for that.

Just one follow up question please. What happens to the posts associated with the user accounts that have been deleted - do the posts remain with a label saying something like "Anonymous user" or are they and all replies to them also deleted?
Offline tha_watcha  
#4 Posted : Saturday, May 12, 2018 11:47:53 PM(UTC)
tha_watcha


Rank: YAF.NET Project Lead

Reputation:

Medals: Medal of Honor: Portal Puzzle Master: Portal Puzzle Master for DNNMedal of Honor Key: Given to pillars of the community who are key players in the YAF community and project.DNN Master: DNN Module ManBug Killer Medal of Honor: Medal for being a kick-ass bug killer!Medal of Honor for the Support King: Support King! Amazing asset to the YAF.NET Community.

Joined: 3/6/2010(UTC)
Posts: 3,832
Germany

Thanks: 70 times
Was thanked: 1174 time(s) in 1004 post(s)
Originally Posted by: BWG Go to Quoted Post
Many thanks for that.

Just one follow up question please. What happens to the posts associated with the user accounts that have been deleted - do the posts remain with a label saying something like "Anonymous user" or are they and all replies to them also deleted?


No in that case the messages of the user will not be deleted, the user name will be replaced with the guest user name for all the messages.

thanks 1 user thanked tha_watcha for this useful post.
BWG on 5/13/2018(UTC)
Rss Feed  Atom Feed
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error