Discussion in 'XenForo Questions and Support' started by fredrikse, Jan 7, 2013.
What would an SQL query look like that assign all members to a secondary user group?
Do it the easy way.
Create a usergroup promotion with some arbitrary criteria such as "User State Is: Valid" that promotes them to the desired usergroup.
That would effectively make everybody a member of the usergroup. unless they are awaiting approval. In which case, as soon as they are approved or have confirmed their e-mail they will get automatically promoted anyway.
I'm about to migrate my vBulletin forum this week. All members will be members och the group registered. Then I also want them all to become members och the member group. So this is something that should effect all members.
What I've described will do that.
I will try that on my test user.
Verified and works great!
It turns out that I was a little bit fast in verifying the result last time. The usergroup promotion is not working as expected (probably because I'm doing something wrong).
These are the criterias that I use:
When criteria is true the user will be member of the usergroup member. Am I missing something here?
Are user groups referring to primary or secondary user groups?
Are you trying to put all registered group users into the members group?
If so the second usergroup option is unnecessary. It won't attempt to promote someone to a usergroup they're already in.
Explain in detail what you're trying to do and I'll help you come up with the right options.
My permission system is based on the groups registered, member and premium. All new members get the membership of registered right away. After ten pre-moderated posts they are transferred to the member group with "normal" account restriction for that type of group. In this scenario when I'm migrating my forum I want all existing users to become member of the member group. That's really what I'm trying to achieve.
Ok. From the beginning.
Assuming all existing users are in the "registered" group already...
1) Admin CP > Users > User Group Promotions > Create New Promotion
2) Title: Whatever. Add user to groups check: "Member"
3) Apply this promotion while: User state = Valid
4) User is a member of any of these groups = Registered
And that's it.
That should promote any user currently in the Registered group to be also in the Member group.
Alright. I'll try that! Maybe the problem was that I had the criteria set that a member should not already be a member of the member group?
Strange. No result yet. I triggered the cron job for usergroup promotions.
I found about 30 records in the database table xf_user_group_promotion_log. There should be more records if all had gotten the right membership. I took some of the user IDs from this table at verified that the they had been granted membership in member group.
I found these thread discussing the same subject:
This is important:
There's a code edit to get around that. Would be good to make that code change now to get done what you need to, then revert it back to normal.
I don't know where the code edit is. Like all good things, it was posted by Jake so I will see what I can find.
EDIT: It's ok, I have worked it out myself.
Back up this file: library/XenForo/CronEntry/UserGroupPromotion.php
And replace it with the one attached.
It worked perfectly. Thanks for helping me out on such short notice, Chris!
Separate names with a comma.