Support Forum

sp_PostIndexUserRank() reporting any user as "Admin"

LH Lee H
Lee H
Member

I should of reported much earlier but I wrote it off as “might be working on it”.

I noticed in topic view the user ranks of any user is admin. Though they don’t have admin ability (I double checked). From within sp-topic-view-functions.php

I did a var_dump of $spThisPostUser and can see $spThisPostUser->rank[0][‘name’] of every user is Admin. I tried tracking down but my brain went to mush too quickly.

Is this just me and a borked upgrade, or is anyone else seeing this?

Edit: I can’t see this in the database. I can only see myself as admin. Unless this value is not in plain text.

13 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Sounds like a bug to me Lee. Thanks for the info. I will open up a ticket and take a look.

Although I will say not something I am seeing. But needs investigating all the same.

YS Yellow Swordfish
Yellow Swordfish
Member

well as I said neither Steve or I get this issue so we should ask you to check your ranking settings – any special ranks – things like that.

LH Lee H
Lee H
Member

I’ve never made special ranks, set up badges or anything before, but I checked all the same.

If visiting as guest, or logged in as normal user or Moderator, all looks correct (Member, Moderator, Admin etc). Ranks are as expected. If logged in as Admin (WP), it shows all members as Admin rank.

MP Mr Papa
Mr Papa
Member

how are you generating the topic view – assuming this is the topic view, right??  are you using the topic class and query?

no rank info is stored in the db…  generated on the fly…

LH Lee H
Lee H
Member

This occurs with the default unmodified theme. On topic pages. I’ve disabled all forum plugins and all WP plugins (MU as well). I’ve tried with WP’s Twenty-Ten and Twenty-Eleven themes. No additional code in profile.php’s, nor additional code in SP’s themes at all.

The only thing I can think of that might have an effect is SP options, or a combination of them. I’ll keep messing around.

YS Yellow Swordfish
Yellow Swordfish
Member

I will try and spend a little time with this today Lee – at least to try and work out what the questions might be 🙂

LH Lee H
Lee H
Member

Progress!!!

This SP is being run on a multisite (blog 1 only) WP! That’s why I’m the only one seeing this.

In sp-api-class-user.php around 175

            # check for super admins and make admin a moderator as well 
            if ($this->admin || (is_multisite() && is_super_admin())) {
                $this->admin = true; 
                $this->moderator = true; 
                $this->usertype = 'Admin'; 
            }

If I remove the check for multisite and super admin like so:

            # check for super admins and make admin a moderator as well 
            //if ($this->admin || (is_multisite() && is_super_admin())) {
            if ($this->admin) { 
                $this->admin = true; 
                $this->moderator = true; 
                $this->usertype = 'Admin'; 
            }

All ranks are displayed correctly. I don’t know why, I haven’t dug far enough… and I admit. Reading and understanding what’s going on inside a class is very hard for me.

LH Lee H
Lee H
Member

is_super_admin() if not passed a user ID will use current users ID. So it was using my ID for all posters. Passing the posters ID fixes this problem 🙂

            # check for super admins and make admin a moderator as well 
            if ($this->admin || (is_multisite() && is_super_admin($id))) { 
                $this->admin = true; 
                $this->moderator = true; 
                $this->usertype = 'Admin'; 
            }
MP Mr Papa
Mr Papa
Member

ah yes. good catch… do need to pass in the user id there…  ticket opened… thanks!

Actually, we have done zero testing on multisite at this point…

MP Mr Papa
Mr Papa
Member

if you do an svn up, this should be fixed now… can you please verify?