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

XF 1.1 Mass moving users to a group

Rho Delta

Well-known member
#1
Is there a way to mass move users to a user group but not all users? I hate going into each profile to move them the a private group, I have about 150 members I need to move.
 

Brogan

XenForo moderator
Staff member
#2
No, there currently isn't an option to do that.

It has been suggested.

BTW, you shouldn't be moving members from the Registered user group, you should just be adding them to others as secondary groups.
 

CTXMedia

Formerly CyclingTribe
#3
Is there a query we can use to move members of one group to another?

I'm consolidating my usergroups before migration in IPB, but some of them cannot be merged until after they're in XF.

Cheers,
Shaun :D
 

Brogan

XenForo moderator
Staff member
#4
You can't do it using queries as the permissions sets need to be updated, and the values are calculated based on all the user groups the user is a member of.
 

CTXMedia

Formerly CyclingTribe
#5
You can't do it using queries as the permissions sets need to be updated, and the values are calculated based on all the user groups the user is a member of.
Wha .... :eek:

Damn. That might present a problem. I can't manually move 700 members to another group. Hmmm.
 

Robbo

Well-known member
#6
You can't do it using queries as the permissions sets need to be updated, and the values are calculated based on all the user groups the user is a member of.
Will truncating the permission_combination tables not force them to rebuild? Or could they do a rebuild by rebuilding the master caches?

Bulk editing of certain things is something that is definately missing.
 

Brogan

XenForo moderator
Staff member
#7
I don't think so.

I think the only way to do it is to do 1 member and check the permission set value, then you can write a script to mass move and update all other members, assuming their user groups and permissions are identical.
 

Robbo

Well-known member
#8
A simple script could do this actually. In a model somewhere...

PHP:
$users = $this->_getDb()->fetchCol('SELECT user_id FROM  xf_user WHERE user_group_id = ?', number here);
foreach ($users as $userId)
{
    $dw = XenForo_DataWriter::create('XenForo_DataWriter_User');
    $dw->setExistingData($userId);
    $dw->set('user_group_id', another number here);
    $dw->save();
}
That would be just changing a user group id but you get the gist of it. First query is where you put a query for all your users. Also this is jsut for primary group, would need some changes for secondary groups.

And now I have thought of a better way. Do your query on your server and then force a rebuild of all permission sets.

PHP:
$users = $this->_getDb()->fetchCol('SELECT user_id FROM  xf_user');
foreach ($users as $userId)
{
    $dw = XenForo_DataWriter::create('XenForo_DataWriter_User');
    $dw->setExistingData($userId);
    $dw->rebuildUserGroupRelations();
    $dw->rebuildPermissionCombinationId();
}
This could be completely wrong btw. I'm just bored.
 

Brogan

XenForo moderator
Staff member
#9
This is what Mike had to say: http://xenforo.com/community/thread...ed-when-deleting-usergroup.10311/#post-140385


That query will sort of work - the permission_combination_id needs to be updated accordingly, which really isn't feasible to do via a query, at least not for everyone. If you know the old combination ID that corresponds to a particular setup and you have the combination ID that matches that setup with a different primary user group ID, then you could change both the group and the combination ID... though there's also a cache in another table too. So all in all, that's a dangerous approach.:)
 

Rho Delta

Well-known member
#11
You could have a checkbox by all names in the member list and have a mass option dropdown box that says like add users then it will bring up an option of what usergroup to add them to. Just a thought, that would make life peachy.
 

Robbo

Well-known member
#12
I would say XenForo will have bulk features some time in the future. I invision tools having various bulk modifying features. I also don't see it as something that is important enough to see any time soon. Just hope an addon developer has a need for something like this and makes it for you.
 

CTXMedia

Formerly CyclingTribe
#13
I've consolidated a number of groups and will probably just merge everything into the Registered group and use promotions to give higher privs.

It'll work out ... :D
 

ChemicalKicks

Well-known member
#15
I'm kinda stuck unless anyone has any suggestions, I would like to move to the cumulative permissions system XenForo uses. Unfortunately when I was running VB I dealt in absolutes, I wouldn't use secondary groups, you just got your primary usergroup changed.

At the moment I have as a base group

Registered Users

The next group with more permissions is called

TNL

=================

I need to get all those TNL users moved to Registered User as their primary group, if I delete the TNL group will everyone move as I require them to?
 

Dean

Well-known member
#18
Yes.

If you delete a user group, any members will automatically be assigned to the default Registered user group.
Mike warned me that may not work with a large number of members in a group.. I am making the changes manually. Taking a while but almost done.
 

snoopy5

Well-known member
#19
Mike warned me that may not work with a large number of members in a group.. I am making the changes manually. Taking a while but almost done.
At waht number it is called "large" number of members within one usergroup? I have some groups, which have 2-3k in it.

Also what can I do i.e. with banned users. I have for example after an import 6 different banned member groups of 6 different vb forums. How can move them in the default banned member group of XF?
 

Dean

Well-known member
#20
At waht number it is called "large" number of members within one usergroup? I have some groups, which have 2-3k in it.
Keep in mind that XF was being improved at a fast pace when this thread was last posted to, so from a technical standpoint my post you quoted is probably quite meaningless.

My vague recollection is that I wanted to be 100% certain that people went into the correct group, so I went into each persons account and manually changed it. Which was a good thing from a user management standpoint because I had found several things I needed to address over the years that I had forgot to do. People requesting things which I had responded to, site changes that I had not made but meant to, several accounts that needed disabling because those people were never going to post again and it would not be a good thing for them to get emails from my site anymore in case someone started a Conversation with them...

I really do not understand the last part of your post. It almost sounds like you have 6 independent vb forums with 6 separate databases and you are merging them?