Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: pulgoki on January 21, 2021, 11:15:57 PM

Title: Adding multiple users to a group
Post by: pulgoki on January 21, 2021, 11:15:57 PM
I've searched and found some topics from 2007 and some outdated mods to help with this. 

I've attempted to migrate from phpbb over to smf.  The migration went pretty well with the exception of some permissions. 

I'm trying to get the permissions sorted out by creating groups, setting group permissions, and then adding multiple members to those groups.  Adding members one at a time is tedious when you have over 100 members to move around.

Is there an easy way that I'm not finding to add multiple members to a group without typing them in one at a time? 
Title: Re: Adding multiple users to a group
Post by: Aleksi "Lex" Kilpinen on January 22, 2021, 12:50:45 AM
It will take some manual typing, but you can add multiple members at one go through Admin -> Members -> Membergroups -> (Click on the membergroup)
At the bottom you'll see "Add a member to this group:" and you can add a list.
Other than that, you'd probably have to go through the DB if you wanted to make mass changes like that.

This is all assuming that the permissions you want to hand out are actually something you want to be handing out manually only to select members in the future as well.
Title: Re: Adding multiple users to a group
Post by: pulgoki on January 22, 2021, 01:18:57 AM
since this is a migration, i'm trying to migrate permissions from one forum to another.  This would be a one time deal. 

This lack of functionality will keep with me phpbb.  I can't spend days typing in 100 users one after the other. 

Thanks for the response. 
Title: Re: Adding multiple users to a group
Post by: Aleksi "Lex" Kilpinen on January 22, 2021, 01:22:19 AM
How did you migrate? I'm not actually sure, but the converters should probably take something like that in to account.
We also have a separate board here for conversions, where I know people have converted from phpbb succesfully in the past.
Would you like me to move this topic over to Converting to SMF (https://www.simplemachines.org/community/index.php?board=20.0)?
Title: Re: Adding multiple users to a group
Post by: pulgoki on January 22, 2021, 01:52:20 AM
The conversion worked great.   

It created a bunch of PHPBB groups that had permissions that didn't line up with this forum. 

I managed to fix most of the groups and permissions but some were pretty specialized.  I needed to add a group that had a majority of members. something like "regular users" that didn't translate over.  Long story behind that.. I don't blame this forum software for that.

Long story short, I need to create a group and add about 100 users to it. 
Title: Re: Adding multiple users to a group
Post by: Aleksi "Lex" Kilpinen on January 22, 2021, 02:07:17 AM
There IS a permission group called "regular users", everyone not added to another primary group will belong to this group.
On top of that, there's post count groups. You do not need to manually add anyone in a group, to alter everyone's permissions.
Title: Re: Adding multiple users to a group
Post by: pulgoki on January 22, 2021, 08:05:54 AM
Quote from: Aleksi "Lex" Kilpinen on January 22, 2021, 02:07:17 AM
There IS a permission group called "regular users", everyone not added to another primary group will belong to this group.
On top of that, there's post count groups. You do not need to manually add anyone in a group, to alter everyone's permissions.

Yes, but when I converted over, it moved my users in to groups that phpbb calls ranks.   I need to move a large number of those users in to the user group.
Title: Re: Adding multiple users to a group
Post by: tjbalon on January 22, 2021, 08:16:11 AM
Quote from: pulgoki on January 22, 2021, 08:05:54 AM
Quote from: Aleksi "Lex" Kilpinen on January 22, 2021, 02:07:17 AM
There IS a permission group called "regular users", everyone not added to another primary group will belong to this group.
On top of that, there's post count groups. You do not need to manually add anyone in a group, to alter everyone's permissions.

Yes, but when I converted over, it moved my users in to groups that phpbb calls ranks.   I need to move a large number of those users in to the user group.

Could you provide a small snip/example of the data of what you are trying to move, how it moved, and what you want corrected? Just for visualization.
Title: Re: Adding multiple users to a group
Post by: Kindred on January 22, 2021, 09:50:40 AM
Quote from: pulgoki on January 22, 2021, 08:05:54 AM
Quote from: Aleksi "Lex" Kilpinen on January 22, 2021, 02:07:17 AM
There IS a permission group called "regular users", everyone not added to another primary group will belong to this group.
On top of that, there's post count groups. You do not need to manually add anyone in a group, to alter everyone's permissions.

Yes, but when I converted over, it moved my users in to groups that phpbb calls ranks.   I need to move a large number of those users in to the user group.

there is no "automated" way to do it directly.
As you know, you can add users individually in their profile or in bunches in the group settings page....  but that does involve manual effort.

The next way would be to directly add them in the database...
1- set up the new group and note the ID of the group (in the example below, the groupID is 44)
2- Assemble a list of User IDs of the users which you want to put in this group (make a comma separated list - in the example below, the three I am users are 21,22,23,24,25)
3- if this group is to be their PRIMARY group (and note that a user in SMF can only have **ONE** primary group) then

SET @id = '21,22,23,24,25';

UPDATE smf_members
SET id_group=44
WHERE FIND_IN_SET(id_member,@id);;


4- if this group is to be a SECONDARY group
(and note, by default secondary groups are not displayed in the user's post-data mini-profile)
(also note, permissions in SMF are PERMISSIVE and INCLUSIVE -- this means that a user has ALL permissions ALLOWED by *ANY* group they are in - the only way to overset this is to turn on and use DENY (which makes that specific permission EXCLUSIVE)
(also, also note, that this assumes that the user does NOT have anything set for secondary groups yet.... )

SET @id = '21,22,23,24,25';

UPDATE smf_members
SET additional_groups=44
WHERE FIND_IN_SET(id_member,@id);;

(If *ALL* of the target users already HAVE secondary groups...   )

SET @id = '21,22,23,24,25';

UPDATE smf_members
SET additional_groups = CONCAT(additional_groups , ',44')
WHERE FIND_IN_SET(id_member,@id);;


(If you have secondary groups already set for some but not all, it becomes more complicated)




As always, BACKUP before doing anything. I have not tested this, but I believe the code above to be correct as it is similar to things I have done in my DB in the past.
Title: Re: Adding multiple users to a group
Post by: pulgoki on January 22, 2021, 09:52:32 AM
I could take a screen shot of the groups. 

The users were placed in to groups based on their rank.  The admins transferred over as Phpbb admins so none of the permissions came with that.

If I had started with this forum everything would be cheesy.  :D   My users are separated in to groups based on their site rank.  I would like to get rid of those ranked groups and start over with post based groups.  I need to move everyone from those post based groups to a single user group and then go forward from there. 

PHPBB seems to have a little more fine grain control over permissions.  It also has a little better ability to deal with multiple users.  Unfortunately for me, I've started liking this forum software better.  I don't know php or sql very well so I'm going to have to see if I can get some help moving these users. 
Title: Re: Adding multiple users to a group
Post by: pulgoki on January 22, 2021, 09:55:32 AM
Awesome, Kindred. 

That may end up being helpful.   
Title: Re: Adding multiple users to a group
Post by: Kindred on January 22, 2021, 09:58:54 AM
I just read your response.... be aware

In SMF, all users belong to ONE post-count-based group (at a time).   Which group the user is put into *IS NOT SETTABLE BY USER*. It is automatically calculated based on their post count.

and post-count -based groups are a completely different field from either of the two I listed above
Title: Re: Adding multiple users to a group
Post by: shadav on January 22, 2021, 10:14:57 AM
Quote from: pulgoki on January 22, 2021, 08:05:54 AM
Quote from: Aleksi "Lex" Kilpinen on January 22, 2021, 02:07:17 AM
There IS a permission group called "regular users", everyone not added to another primary group will belong to this group.
On top of that, there's post count groups. You do not need to manually add anyone in a group, to alter everyone's permissions.

Yes, but when I converted over, it moved my users in to groups that phpbb calls ranks.   I need to move a large number of those users in to the user group.

by default all registered members (that do not have special "ranks") are in the group regular member

now smf has what it calls Post count based groups (members are automatically added per the number of posts that they have)
examples
Newbie 0 posts
Jr. Member 50 posts
Full Member 100 posts
Sr. Member 250 posts
Hero Member 500 posts
these are the default settings, you can change them however you like or add more post based groups

and then special groups (Regular groups: which would be sort of like phpbb's ranks)
examples
Administrator
Global Moderator
Moderator
these are the default settings, you can change them however you like (you can not delete administrator or moderator) or add more "ranks" like donators, or support team, or whatever

if you go to your permission settings you should see
Guests (?)
Regular Members (?)
Administrator (?)
Global Moderator
Moderator (?)

if you go to the settings and check the box for Enable permissions for post count based groups and then go back to permissions you should now also see your post based groups
Newbie
Jr. Member
Full Member
Sr. Member
Hero Member

so for instance I have 2 members on my test forum
in the below picture you can see that
Regular members has one user (my test user)
Admin has one user (me)
Global Mod has on user (also me, it's set as my secondary group, for testing purposes)
and then the post based group, Newbie, has 2 members (me and my test user as neither has more than 50 posts)
Title: Re: Adding multiple users to a group
Post by: pulgoki on January 22, 2021, 12:45:39 PM
Quote from: shadav on January 22, 2021, 10:14:57 AM


if you go to the settings and check the box for Enable permissions for post count based groups and then go back to permissions you should now also see your post based groups
Newbie
Jr. Member
Full Member
Sr. Member
Hero Member


Out of curiosity, what does it do with the members of those groups if I turn that feature off?
Title: Re: Adding multiple users to a group
Post by: Aleksi "Lex" Kilpinen on January 22, 2021, 12:48:44 PM
Then you can only set their permissions and board access from the "regular members" group, or any manually assigned membergroup. The post count groups are optional, and allow you to set permissions and access based on post count.
Title: Re: Adding multiple users to a group
Post by: Kindred on January 22, 2021, 01:07:13 PM
well, to be clear....  the post count based groups are automatic, and are not optional.  Everyone WILL belong to a post-count based group.

You can, however, turn off the PERMISSIONS for post-count-based groups so that there is no special permissions.

You can also delete all of the post-count-based groups EXCEPT for the "0" post count group.   That one CAN NOT BE DELETED!!!!!  If you, somehow, manage to delete that group, it will cause many many many problems in your system. don't do it.
Title: Re: Adding multiple users to a group
Post by: Aleksi "Lex" Kilpinen on January 22, 2021, 01:41:46 PM
Well, yes - Post count groups are not entirely optional, I did mean the post count group permissions. I should have been more specific.
Title: Re: Adding multiple users to a group
Post by: shawnb61 on January 22, 2021, 01:54:53 PM
Note you do not need to add them one at a time.  You can do it all in one action.

The 'List of Members to Add:' field accepts a list of names, comma separated.

E.g., this would work & add all 4:   joe, tom, larry, bob

But you still need that list of names from somewhere...  Shouldn't be hard, though, if you're only talking about 100 names.  Should take about 2 minutes.

If we were talking thousands, I'd find a way to automate building the string from extracts from the old DB.  Or figure out why they didn't come over in the converter.
Title: Re: Adding multiple users to a group
Post by: pulgoki on January 22, 2021, 02:22:26 PM
Quote from: shawnb61 on January 22, 2021, 01:54:53 PM
Note you do not need to add them one at a time.  You can do it all in one action.

The 'List of Members to Add:' field accepts a list of names, comma separated.

E.g., this would work & add all 4:   joe, tom, larry, bob

But you still need that list of names from somewhere...  Shouldn't be hard, though, if you're only talking about 100 names.  Should take about 2 minutes.

If we were talking thousands, I'd find a way to automate building the string from extracts from the old DB.  Or figure out why they didn't come over in the converter.

haha.. you found a way to make me feel lazy.

Actually you did give me a thought.  I may screen shot and just start typing names.  I have about four pages.  It would take longer than two minutes, but you do have a very good point. 
Title: Re: Adding multiple users to a group
Post by: shawnb61 on January 24, 2021, 01:25:01 AM
Quote from: pulgoki on January 22, 2021, 02:22:26 PMhaha.. you found a way to make me feel lazy.

Ooops, sorry, not my intention...  Just drink a lot of ☕☕☕☕, type very fast, & assume everyone does the same... 

Hope the input helped,

Title: Re: Adding multiple users to a group
Post by: pulgoki on January 24, 2021, 09:57:24 AM
Quote from: shawnb61 on January 24, 2021, 01:25:01 AM

Ooops, sorry, not my intention...  Just drink a lot of ☕☕☕☕, type very fast, & assume everyone does the same... 

Hope the input helped,

I was just joking.  :D    Everyone here has been really helpful and I really appreciate everyone's input. This is probably one of the better support forums I've visited.   Thank you!