Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2003
Posts: 64
Power User
Power User
Offline
Joined: Feb 2003
Posts: 64
I have a membership only database where anyone who subscribes gets access. Anyone who pays is put into a "paid member" user group. When they're subscription runs out, they are dropped down to a group called "users" which has no access. How can I delete all the members in my database that are just "users" without effecting the "paid members"?

Sponsored Links
Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
What version? In 6.4 there is an option in the Admin panel called "mass group change" that will allow you to remove users from a specific group.

Joined: Feb 2003
Posts: 64
Power User
Power User
Offline
Joined: Feb 2003
Posts: 64
I am using 6.4.2, sorry should have said that.

I'm aware of the Mass Group Change, but I want them removed, not just changed to another user group.

Thanks.

Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
I wouldn't delete any users just leave them in that group where they have no access because any post they made when subscribers would go all funky because they wouldn't have the user listed anymore of who wrote the thread.

Joined: Feb 2003
Posts: 64
Power User
Power User
Offline
Joined: Feb 2003
Posts: 64
I was trying to avoid getting this detailed about the situation, but here's the whole story:

I started a free site about 18 months ago and had around 5,000 members sign up. Then 12 months ago, we moved to a paid subscription model. Using a program called aMember to manage our payments and members, anyone who chose to not pay the subscription was cut off. When someone registers for my site, they do so through aMember, which checks their email address and username for uniquness in the ubbt database. If no record is found, they are allowed to proceed, complete the signup, and are placed into a paid member group. If their email address is found in the db, they are told that they have been a member in the past and must use a different form to re-register. The whole process is rather confusing. I am trying to avoid all of this by removing anyone who initially did not pay to become a member so that if they do come back, the db treats them as a new customer.

This is the reason I need to flush all of these members out, only leaving the paid members.

Sponsored Links
Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
yes but say all parent threads or children replies are created by user #213 Larry Johnson.. and you now delete Larry Johnson all posts with his usernumber anywhere remotely connected will stop functioning and will become broken. Also the way the user database works you will never recover the #213 for anyone else. Now while you could do a mysql query and update all posts with user #213 to a say a dummy with the name of Delete Moi who is say user #9037 and then delete the User #213 user I wouldn't chance it.

Joined: Feb 2003
Posts: 64
Power User
Power User
Offline
Joined: Feb 2003
Posts: 64
The posting issue is non-existant. The only people who post to my site are myself and my partner, both admins. We have a job board where people submit stuff to us via email, then we post it. Our members can then come and view it, but cannot reply or post directly to the board.

Probably should have mentioned that above, sorry.

Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
oh ok then it's cake if there name is not on any post then I would say go ahead and delete em. you can delete say all users in group #65 Mugwumps by doing

DELETE FROM w3t_Users
WHERE U_Groups = '65'


in the admin panel under sql command.

[:"red"] BUT make sure to backup the database first [/]

Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
65!

Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
depends on how many groups he has and knowing some people out there if I typed U_Groups = '2' they would have entered that as literal

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Groups are stored in the U_Groups field in this format "-2-3-4-".

But I wouldn't recommend deleting users directly like that - leaves too much mess behind in other tables. 6.5 will have a custom search/delete ability. Until then, if it were me, I'd tweak the "delete inactive users script" a bit so it only deleted inactive users that were not part of your member group. That would be a simple one line change and would allow safe deletion.

If you want me to post some code - I can later - what user group number is your paid member group - do this to find out:

SELECT *
FROM w3t_Groups

Joined: Feb 2003
Posts: 64
Power User
Power User
Offline
Joined: Feb 2003
Posts: 64
Thanks everyone for your input.

Josh, the user ID (listed as the G_Id) is 6 for the paid member group. The group that I want to empty is the Users, which is ID 3 (but I guess that's the same on everyone's ubbt, huh?). Anyway, thank you again for the help. If you need anything else from me please let me know.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
OK - in /admin/dopurgeusers.php

Find this query:
Code
<br />    SELECT U_Number,U_Username<br />    FROM   {$config['tbprefix']}Users<br />    WHERE  U_Laston <= $purge<br />    AND    U_Number > 2<br />


Change it to this:
Code
<br />   $query = " <br />    SELECT U_Number,U_Username<br />    FROM   {$config['tbprefix']}Users<br />    WHERE  U_Laston <= $purge<br />    AND U_Groups NOT LIKE '%-6-%'<br />    AND    U_Number > 2<br />



Then - from your admin menu - use the normal "purge inactive users" function - and put the number of days that you want - but it'll Always ignore anyone in the usergroup 6.

That way, as you'll see - the rest of the dopurgeusers script does all the other clean up in the other tables and the user gets properly deleted.

Joined: Feb 2003
Posts: 64
Power User
Power User
Offline
Joined: Feb 2003
Posts: 64
That's great, Josh, thank you so much!

I'm just assuming here, but that code won't effect the mods or admins will it? I figured it won't, but it doesn't hurt to ask.

Thanks again.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Will they be in the member group? If they are not in the group 6 and they haven't logged in within the specified number of days - then they are elibible for deletion.

If you want to add the admin & moderator groups (they are groups 1 & 2) you'd adjust it like this:


AND U_Groups NOT LIKE '%-6-%'
AND U_Groups NOT LIKE '%-1-%'
AND U_Groups NOT LIKE '%-2-%'

Joined: Feb 2003
Posts: 64
Power User
Power User
Offline
Joined: Feb 2003
Posts: 64
Josh, as always, you rock! Worked like a charm. Those freeloaders are now out on their ear . Great job!


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)