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

XF 1.5 Administrative users.

andybond

Active member
#1
Hi ,
I imported a board. All went well. However I have noticed that a vast majority of the users are in the group administrative.
Here is the rub though , if I search for members noone appears in the administrative group.

What is going on ?
 

andybond

Active member
#3
I have dug into the MYSql.

I can see these users have a User_Group_Id of 19.
It should be 2.

Anyone generate me some SQL To change these users only ?
 

Chris D

XenForo developer
Staff member
#5
That would likely explain it, though I would still be interested in understanding why this might have happened. Which software did you import from? Which importer did you use? Was it the default one or a third party one?

That query looks like it would do what you want. That said, I would recommend taking a different approach; how many users does this actually affect?

SELECT COUNT(*) FROM xf_user WHERE user_group_id = 19

If it only affects a handful of users (which presumably would be the case if it's Admin users) then you should do it via the Admin CP manually. You'll almost certainly experience issues with incorrectly cached permissions doing it automatically in the database.
 

andybond

Active member
#6
That would likely explain it, though I would still be interested in understanding why this might have happened. Which software did you import from? Which importer did you use? Was it the default one or a third party one?
Hi Chris , phpBB , default xen importer.


That query looks like it would do what you want. That said, I would recommend taking a different approach; how many users does this actually affect?
Sitting down ? 1063!

You'll almost certainly experience issues with incorrectly cached permissions doing it automatically in the database.
Can I rebuild the user cache once updated in the mySQL ?
 
Last edited:

Chris D

XenForo developer
Staff member
#7
Heh, well that all makes a little bit more sense. So they're not admins at all, hence why you're setting the user group ID to 2 (which is Registered).

Is there anything else that distinguishes them from the others? For example, do they all have Registered as their secondary group? What about actual Admin users, what groups are they in?

I'm just wondering if you can use the Batch Update Users function in the Admin CP, search for only users who have a secondary group as Registered, and then set their Primary group to Registered and remove Registered as their secondary group:

upload_2016-8-14_21-2-5.png

I would say at this point is if even this ends up targeting and breaking any Admin or Moderator users, doing this, and then fixing those fewer users by hand is still going to be preferable to doing manual queries.
 

andybond

Active member
#8
I have had a play around and I simply cannot differentiate these people with the query tools inbuilt into Xen to manipulate them.
 

Chris D

XenForo developer
Staff member
#10
My point mostly is if these 1063 users should all be in the Registered user group as their primary group, shouldn't all of your other users also be in the same Registered group as their primary group, and other groups just applied via secondary groups? How many other user groups do you actually use as primary groups? Looking at your list of user groups, you only have Administrative, Events and Moderating. If some of the other users have these groups as their primary group, and the Batch Update Users method I mentioned above affects them too, this might not actually be a bad thing. The general recommendation is that everyone should have the base set of permissions set via the primary Registered group, and any additional permissions cumulatively added using secondary groups.

So, another approach is this:

Search for all users who are in the Events primary group, change the primary group to Registered and add "Events" as a secondary group.
Repeat for Moderating and Administrative if applicable.

Then the only users remaining should be the others which presumably should just only have a single user group, which is "Registered" as their primary group.

I'm not actually sure there would be a way to properly refresh any permission caches, so the method above is going to be a lot safer.
 

andybond

Active member
#11
shouldn't all of your other users also be in the same Registered group as their primary group, and other groups just applied via secondary groups?
I agree. But something fundamentally went wrong with the 1063 users ! I dont know what ...

How many other user groups do you actually use as primary groups?
Only the inbuilt one , so registered , administrative , moderator .

I'm not actually sure there would be a way to properly refresh any permission caches, so the method above is going to be a lot safer.
Say for instance a "user" lets call him MandyPond got a bit SQL query happy here , and didnt have the route to go down , that would be bad , right ?

Ill reset a users password ( with their permission ) and sign in to see what happens ..