• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

SQL query to assign user group to all memners

Chris D

XenForo developer
Staff member
#2
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.
 

fredrikse

Active member
#3
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.
 
#7
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.
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:

usergroup_promotion.png

When criteria is true the user will be member of the usergroup member. Am I missing something here?
 

Chris D

XenForo developer
Staff member
#9
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.
 
#11
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.
 

Chris D

XenForo developer
Staff member
#12
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.
 
#15

Chris D

XenForo developer
Staff member
#16
This is important:

Note that the cron only updates users who have been active in the last 72 hours, so there may be a delay for some users despite manually running the cron.
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.
 

Attachments