XF 1.5 is_moderator flag inconsistency

sccrgy789

Member
Hi there-

We just completed the migration of a pretty large forum from vBulletin 3.x to XenForo 1.5.x. So far, everything has been going pretty well but we're noticing some weird behavior with the is_moderator flag on users. I'm not sure if something is wrong somewhere in our XF or if we're misunderstanding what the correct behavior is.

Background information on our staff types:
- Administrators (defined as admins in the AdminCP)
- Global Moderators (given forum moderator permissions to all nodes by their user group)
- Sectional Moderators (given forum moderator permissions in their assigned nodes by their user group)

The important thing to note is that none of our admins or moderators are actually defined as moderators under AdminCP > Users > Moderators because, to be honest, it's a royal pain. Instead, we give their user groups forum moderator permissions in their respective nodes so we can just add/remove people from groups and their permissions follow. (This is modeled after how vBulletin handled permissions, so perhaps we have to adjust our methodology here...)

For the most part, this seems to work. However, we've noticed:
- Most of our mods have is_moderator = 0
- Since XF doesn't think they're mods, it doesn't always give them all of the mod options they should have like access to the Reports feature
- When they perform "mod" actions (IE locking a thread) it doesn't seem to show up in moderator logs (presumably because XF doesn't think they're mods)
- Some of our mods and one of our administrators, for no apparent reason, do have is_moderator = 1

As a side note, we thought we may have some caching issues so we rebuilt the user cache and the issue is still present. Our XF instance is spread across an 8 server cluster, but our MySQL should all be in sync.

Finally, I read somewhere on this forum that is_moderator should be determined by whether or not users are defined as Moderators in the AdminCP. This makes sense, but in our xf_moderator table we have 1 record and in our xf_user table we have 9 users with is_moderator = 1.

Any thoughts/information would be greatly appreciated.

Thanks!
-Matt
 
You mention a large forum, so I'm not sure if you used a non-standard importer, but if you did, that would likely explain the inconsistency about this flag.

For this flag to be set, the users will need to be defined as moderators (you don't have to give them manual permissions if you don't want). There really isn't a way to do this other than manually.
 
Thanks for the prompt replies... We did use a custom importer so that may explain it (our other admin did the import work, so I'm not sure exactly which but I think he mentioned something about DigitalPoint). I was hoping rebuilding user caches would sort it out, but I suppose I shouldn't expect the cache to actually alter the database.

A couple follow up questions:
1. Would it make sense in our case to add them as moderators with no permissions? Then XF will think they're mods but we can still use the group-based permissions?
2. For the users who are not moderators but are showing as is_moderator = 1 in the database, should we just change that field to 0?

I also wanted to ask about an issue with our user group username CSS (I can open another thread if need be, let me know). We have some users in multiple user groups (each with its own CSS) and their usernames are still showing without markup. We have priorities set on the groups so one of the groups should always have the highest priority, but they still don't get any markup. Again, we thought rebuilding the cache may resolve this but it didn't. Is there anything else I could check to see why they may not be getting markup?

Thanks very much! Really pleased with XenForo so far, just trying to iron out some kinks :)
 
Would it make sense in our case to add them as moderators with no permissions?
That's one of the ways of doing it and how I do it on my forum - the permissions are set in the Moderating user group.

For the users who are not moderators but are showing as is_moderator = 1 in the database, should we just change that field to 0?
Toggling them as moderators should also resolve that - although if you're going to set them as moderators anyway, it will be set to 1.

The user group CSS issue could be another issue related to the importer.
Try toggling a member in/out of the user group to see if it changes anything.
 
Awesome, so I think I have my moderators all sorted out for now.

The CSS issue however, I'm still struggling with. I removed one of the users without CSS markup from their staff groups (the ones with CSS defined) and added them back. Still looks like their name isn't getting any CSS markup.
 
The markup is directly on the user group. Here's an example:

7703aba5f3b73bfa8dcb71b941744332.png


One of the users who has no markup is in the group with the above markup, in addition to a couple others. The CSS looks valid...
 
No, the group they're in with the highest priority doesn't have any CSS. I suppose that explains it because I looked in the database and the user's display_style_group_id is the group with the highest priority (and no CSS).

I was assuming XF would only consider the priorities from groups with styling and would ignore groups without. I looked at some of the functions in /Model/UserGroup.php and see how XF is assigning the display priority. I may try to override some of these functions to have it ignore groups without any CSS while calculating priorities. The fun part will be getting everyone recalculated.

I also wanted to share something we noticed about user titles and user title ladders, it may be helpful information for others using importers. We had a bunch of users complaining their titles weren't advancing through the ladder. The ladder is enabled and we have the tiers set correctly. But users with enough posts for tier 2, for example, would still have the title from tier 1. The issue was that the importer took people's vBulletin titles (which were from vBul's title ladder) and put them in custom_title and XF wasn't overriding them. Once we cleared out custom_title (where appropriate) the ladder took effect.

If you guys don't mind, I'll keep going with questions here as long as I have more... We've sorted a lot out on our own, but there are still some lingering bug reports from users in my queue that I haven't managed to figure out. The next one has to do with viewing profiles for users who have usernames starting with a number and then a dash. For example, the user's profile link will be: /members/111-kyle.214712/ but when you go to it, you get redirected to /members/member.111/ and get a 404. (But /members/360noscope420.481059/ will work fine, maybe because there's no dash?)

Seems like XF not parsing the username versus user ID portions of the URL correctly?
 
This will almost certainly be down to redirects you have added (such as to .htaccess) to redirect your old URLs. You would need to change the matching to ensure there's no "." later in that part of the URL.
 
Top Bottom