Support Forum

sp_PostIndexUserRank() reporting any user as "Admin"

1 2 >
Lee H
Coastal New England (USA)
Member
Free Members
Jul 24, 2011 - 11:10 pm

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.

Yellow Swordfish
Glinton, England
Member
Jul 25, 2011 - 4:12 am

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.

Lee H
Coastal New England (USA)
Member
Free Members
Jul 25, 2011 - 9:33 am

Just let me know how to assist.

Yellow Swordfish
Glinton, England
Member
Jul 25, 2011 - 10:10 am

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.

Lee H
Coastal New England (USA)
Member
Free Members
Jul 25, 2011 - 4:17 pm

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.

Mr Papa
Simi Valley, CA
Member
Free Members
Jul 25, 2011 - 8:55 pm

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...

Lee H
Coastal New England (USA)
Member
Free Members
Jul 26, 2011 - 1:23 am

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.

Yellow Swordfish
Glinton, England
Member
Jul 26, 2011 - 2:52 am

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

Lee H
Coastal New England (USA)
Member
Free Members
Jul 27, 2011 - 9:15 pm

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.

Lee H
Coastal New England (USA)
Member
Free Members
Jul 27, 2011 - 11:22 pm

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'; 
            }
1 2 >