XF 1.5 SQL Help - Adding Secondary Groups, and Upgrades

Michael Murguia

Active member
Hi All! First, thank you in advance for your help! Below, the specific question is highlighted in blue!

I think I am about half way through this project, and would love some help completing the task.

Part 1
Adding a secondary group via SQL using an email list works fine like this:

Code:
UPDATE xf_user SET  secondary_group_ids =  '6' WHERE email IN ('email1@gmail','email2@gmail');

Unintended behavior 1: This also removes preexisting secondary groups for the list of users. Can this be prevented? I only want to add, not remove groups.

Unintended behavior 2: Once secondary groups are set using this method, adding an upgrade package which adds these users to a secondary group no longer works. When upgraded, they are not added to the secondary group associated with the upgrade.

Part 2
At the same time, I would like to add an upgrade package for the list of users. I imagine the SQL would be similar to Part 1, but I don't know the proper syntax. I think I would need to know the term for the upgrade package equivalent of "secondary_group_ids". Again, its important no other upgrades are removed.
 
You absolutely can't add users to groups like this. If you're going to do it, you must do it through the same approach and APIs that XenForo uses (via PHP). Attempting to modify the database like this WILL cause problems and break things. There is a lot more to modifying user groups than just modifying this one area.
 
You absolutely can't add users to groups like this. If you're going to do it, you must do it through the same approach and APIs that XenForo uses (via PHP). Attempting to modify the database like this WILL cause problems and break things. There is a lot more to modifying user groups than just modifying this one area.
Ah! I was doing this on someone else's advice. Good to know! So, given these needs, do you have a recommendation? I have about 1,000 users to check and update. What would be the best way to do it?

Thanks!

M
 
Last edited:
Unless you're comfortable writing custom PHP code to modify these users and interact with XF's API, I'm afraid adding them via the control panel may be what needs to be done.

If you want to go down the root of a user upgrade for these users, you need to do that instead of the direct group manipulation. This ensures that the group membership is connected to them having the upgrade active (so if the upgrade expires, the group is removed).
 
Unless you're comfortable writing custom PHP code to modify these users and interact with XF's API, I'm afraid adding them via the control panel may be what needs to be done.

If you want to go down the root of a user upgrade for these users, you need to do that instead of the direct group manipulation. This ensures that the group membership is connected to them having the upgrade active (so if the upgrade expires, the group is removed).
OK, thank you. I'd be interested in hiring for plugin development to do this if anyone is interested. Does this site refer developers?

Thanks again!

M
 
Top Bottom