MyBB Community Forums

Full Version: sql query to move users to a new group
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
hi guys,

does anyone know the proper query to move users who have both X posts and have been registered for Y days from their current user group to a new one?

I have this one which moves users from one group to a new group with a certain amount of posts, but not any type of time they've been registered on the forum:

UPDATE `mybb_users` SET `usergroup` = 'X' WHERE `usergroup` = 'Y' AND `postnum` > 'Z'
I believe the user promotions task can do this, it probably would be the best way to do it.

ACP>Users & Groups>Groups Promotions
(2013-04-15, 05:03 AM)Paul H. Wrote: [ -> ]I believe the user promotions task can do this, it probably would be the best way to do it.

ACP>Users & Groups>Groups Promotions

that'll probably do it, too. thanks.
Group promotions will only promote them if they log in.
(2013-04-15, 01:53 PM)vEconomy Wrote: [ -> ]Group promotions will only promote them if they log in.

that might be a good point. in that case, is there a query I can run to achieve this to move a bulk of the users and just rely on the group promotion to do the work after that?
I don't think login is necessary for group promotions? A visitor should be present on site for task to initiate. Although I'm not sure as I've never used it.
I have used group promotions on a lot of my sites. And if I set group promotions and then run them. it won't effect any of them until they log in.
I'm not exactly sure when it's supposed to run, but I set up the group promotion about 4 hours ago and it's only moved 1 user so far. There's almost 1,600 users in the 1 group, and I'm guessing at least 1,200-1,300 of them should get moved to this new group.
bumping this.

I set up the group promotion and it's only moved 4 users in almost a week when it should of moved about 1,200 users.
To update users that have been registered at least N units of M
UPDATE `mybb_users` SET `usergroup` = 'X' WHERE `usergroup` = 'Y' AND `postnum` > 'Z' AND TIMESTAMPDIFF(M, NOW(), FROM_UNIXTIME(`regdate`)) >= N

M can be any of FRAC_SECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.

example, registered at least 5 months

UPDATE `mybb_users` SET `usergroup` = 'X' WHERE `usergroup` = 'Y' AND `postnum` > 'Z' AND TIMESTAMPDIFF(MONTH, NOW(), FROM_UNIXTIME(`regdate`)) >= 5
Pages: 1 2