XF 2.1 Need a query to move people in a table to a user group

Fattycakez1

Active member
Hi,

I'm trying to move every single person in "xf_user_upgrade_expired" to a specific secondary usergroup

Can i achieve that with a query?
 
Solution
I'm trying to move every single person in "xf_user_upgrade_expired" to a specific secondary usergroup

Can i achieve that with a query?

This should work ...

Code:
UPDATE xf_user
JOIN xf_user_upgrade_expired
ON xf_user.user_id = xf_user_upgrade_expired.user_id
SET xf_user.secondary_group_ids = CONCAT(secondary_group_ids, ',xx');

... xx at the end of the last line representing the id of the user group you want them in.
I can’t help with the query, but if you don’t manage to get any answers you should be able to achieve this using batch update users and this addon:

 
If an upgrade has expired, shouldn't the members be automatically removed from a specific user group? If so, use the batch update to search for members that no longer belong to that user group.
 
I can’t help with the query, but if you don’t manage to get any answers you should be able to achieve this using batch update users and this addon:

Thank you i will try that out <3

If an upgrade has expired, shouldn't the members be automatically removed from a specific user group? If so, use the batch update to search for members that no longer belong to that user group.
The thing here what im trying to achieve i want to purge every user that has never bought an upgrade from my website and as u said they're no longer in a group because they expired so i want to batch add them in a usergroup so when i purge every user they don't get deleted.
 
You could support this suggestion:
Also, I had suggested this for Communication.
 
Last edited:
I did something similar to this maybe it will help.
Create a custom check box field for users called "Expired Upgrade".
User editable: No
Then you can run a query to put the check for your expired members (you will have to request the query).
Then when you run Batch Update, you can delete by custom field criteria and leave it unchecked. You will see the check box there.

This may be easier than the group query but just an alternative for you.
 
I did something similar to this maybe it will help.
Create a custom check box field for users called "Expired Upgrade".
User editable: No
Then you can run a query to put the check for your expired members (you will have to request the query).
Then when you run Batch Update, you can delete by custom field criteria. You will see the check box there.

This may be easier than the group query but just an alternative for you.

User Criteria Extended​


Did the trick it's very very advanced

thank you though i do appreciate your help.
 
I will also check into that, thanks for the tip.
Well bad news it seems like the upgrade section in the addon is broken or doesn't do anything

Because i been trying for the past 2 hours and nothing is working from the upgrades section or i'm just an idiot not sure...

If you don't mind can you provide the way you moved expired upgrades to a group
 
I'm trying to move every single person in "xf_user_upgrade_expired" to a specific secondary usergroup

Can i achieve that with a query?

This should work ...

Code:
UPDATE xf_user
JOIN xf_user_upgrade_expired
ON xf_user.user_id = xf_user_upgrade_expired.user_id
SET xf_user.secondary_group_ids = CONCAT(secondary_group_ids, ',xx');

... xx at the end of the last line representing the id of the user group you want them in.
 
Solution
This should work ...

Code:
UPDATE xf_user
JOIN xf_user_upgrade_expired
ON xf_user.user_id = xf_user_upgrade_expired.user_id
SET xf_user.secondary_group_ids = CONCAT(secondary_group_ids, ',xx');

... xx at the end of the last line representing the id of the user group you want them in.

You're a hero thank you so much my man.
 
Back
Top Bottom