I need an SQL query that I can run that will change all members user group who have 500 or more posts.
Have you tried the Group Promotion?
Yes but they don't seem too be moving everyone with 500 posts over and they add them as secondary user group.
FYI: I need the query to only move members in the Registered User Group with 500 posts.
UPDATE xf_user SET user_group_id = x WHERE message_count = 500;
OT curiosity question... are you finding something that is easier to do by having them in a new primary group instead of a secondary group? With The-Forum-That-Shall-Not-Be-Named (OK, OK, vBulletin) I used to use a lot of primary groups but with XF I *think* so far I can get away with just using secondary groups.Yes but they don't seem too be moving everyone with 500 posts over and they add them as secondary user group.
FYI: I need the query to only move members in the Registered User Group with 500 posts.
First of all make a backup of your users table and run this query:
Code:UPDATE xf_user SET user_group_id = x WHERE message_count = 500;
Replace x with the group id that you want to move the users with 500 posts and xf_ with whatever prefix you are using for your db tables.
P.s. You might want to run the Rebuild User Caches as well after the query. btw.
UPDATE xf_user SET secondary_group_ids = 9 WHERE message_count > 500;
OT curiosity question... are you finding something that is easier to do by having them in a new primary group instead of a secondary group? With The-Forum-That-Shall-Not-Be-Named (OK, OK, vBulletin) I used to use a lot of primary groups but with XF I *think* so far I can get away with just using secondary groups.
Before changing their primary groups, definitely check out that guide Brogan posted. The permissions can be a bit of a mind bender at times but after while it makes sense.I am going to try to use secondary usergroups for this. I am still new to the user group setup that xenForo uses.
Shouldn't it be this:
Code:UPDATE xf_user SET secondary_group_ids = 9 WHERE message_count > 500;
As I want to update it for everyone with greater than 500 posts.
FYI: I need the query to only move members in the Registered User Group [B]with 500 posts[/B].[/quote]
[/CODE][/quote]You did not say that you wanted to change the secondary groups. That can be done with the group permissions which I already mentioned. Also you said that you wanted to move users with 500 posts as per your other post above.
Code:FYI: I need the query to only move members in the Registered User Group [B]with 500 posts[/B].[/quote]
Anyway, to move all users with 500 posts and above use this operator: >=
I need an SQL query that I can run that will change all members user group who have 500 or more posts.
$users = $userModel->getUsers(array(
'user_state' => 'valid',
'is_banned' => 0,
'last_activity' => array('>', XenForo_Application::$time - 86400 * 3)
), array(
'join' => XenForo_Model_User::FETCH_USER_FULL
));
ini_set('memory_limit', -1);
ini_set('max_execution_time', 5000);
We use essential cookies to make this site work, and optional cookies to enhance your experience.