Support Forum

Lost moderator display and ranks

DA Dave
Dave
Member

I’ve mapped WP roles to SF ranks and part of that is Contributors become Moderators. Last week I added a new Contributor, but the Moderator role did not work and the rank was not displayed under their gravatar. Somehow, while trying to fix that I lost all moderators from the info panel that shows who’s online, moderators, admins, etc.
moderators-memberships.pngmoderators-missing.pnguser-mapping-settings.pngwrong-rank-displayed.png

Also if you look on the Members Info screenshot you’ll notice there is a bug – it display’s a % before “Back to all Members”.

11 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Thanks for the bug info on the label. I will get that fixed up.

And talking of bugs ! I am afraid that is probably the reason for your lost moderators and one of the primary reasons we are aiming to push put a 5.1.2 update a little earlier than we had originally planned.

Apart from membership of a moderator designated User Group for the sake of performance and to save some complex SQL queries, we also identify a Moderator by a column in the sfmembers table. In fact a column called ‘moderator’ which will be set to a 1 for all those so designated. I am not sure what the bug actually was but I DO know that the effect was for this column to be reset to zero. And for this I apologise. It is fixed up in the forthcoming 5.1.2 which we plan – all being well – to release at the end of this week.

The bug itself is an easy fix and the code changes are available here: http://websvn.simple-press.com/comp.php?repname=Simple:Press&compare[]=/@8705&compare[]=/@8706

i will need to ask Steve if there is a trick to getting them all back in one go – I suspect you may be able to do that but as I say – need to check. They can be out back to 1’s manually of course in the table.

Again – our apologies.

DA Dave
Dave
Member

Ah ha. Thought I was going crazy!
The link didn’t copy/paste well – seems there are some invalid characters, at least they appear that way.

So what’s the code for the cool new breadcrumb? laugh

MP Mr Papa
Mr Papa
Member

in simple-press/sp-api/sp-api-users.php, find routine sp_update_member_moderator_flag() and replace it with this code:

function sp_update_member_moderator_flag($userid) {
    $ugs = sp_get_user_memberships($userid);
    if ($ugs) {
        foreach ($ugs as $ug) {
            $mod = spdb_table(SFUSERGROUPS, "usergroup_id={$ug['usergroup_id']}", 'usergroup_is_moderator');
            if ($mod) {
                sp_update_member_item($userid, 'moderator', 1);

                # see if our forum moderator list changed
                sp_update_forum_moderators();
                return;
            }
        }
    }

    # not a moderator if we get here
    sp_update_member_item($userid, 'moderator', 0);
    
}

as to the breadcrumbs, not just a small piece of code… 😉  some fancy css, a filter and some images…

BrandonC did the work for us here, so you might want to contact him… or search for the thread where he walked another user through how to set it up…

DA Dave
Dave
Member

Code is updated. Do I need to do anything else (manually reassign, etc)?

YS Yellow Swordfish
Yellow Swordfish
Member

I suspect you are going to have to manually put the ‘1’s back in the moderator column of the sfmembers table.

Or – remove the users from the Moderators user group and then re-assign them…

I really do apologise for this. Looks like an area we need to get some more rugged checking in and rebuild code.

DA Dave
Dave
Member

No problem at all. I mean you’ve created one of the best forum software available and the amount of support the 3 of you provide is incredible.

OK, code updated. Members removed from/added to Moderator group, however the moderator rank badges do not display. They did before the problem happened and moderators added after the problem had a member rank badge displayed – now nothing.

The fix also did not populate the Moderator list in the stats.

YS Yellow Swordfish
Yellow Swordfish
Member

Thanks!

The stats are cached and should update hourly (I believe). So watch for that. if it doesn’t update we can force it.

Now tell me about the badges… Is this a User Groiup based badge or a Special Rank badge? And if a Special Rank badge are all the designated members assigned in the Ranks admin panel?

DA Dave
Dave
Member

It’s a special rank and 8 of the 10 appear to have made it, which would leave the 2 who were added after the problem started as missing. Let me try to add them manually… That worked.
I’ll hold off for an hour, or so, and see if the stats update.

YS Yellow Swordfish
Yellow Swordfish
Member

Assuming you are running on SP 5.1.1 then you could go to the forum admin > Toolbox > CRON Inspector – and then in the Run CRON input box at the bottom enter sph_stats_cron and run it on demand…

DA Dave
Dave
Member

Everything seems to be fine so we can call this a success. Looking forward to the next update!