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

Not a Bug Resources Count doesn't show for own Member Card

Discussion in 'Resource Manager Resolved Bugs' started by Jeremy, Apr 21, 2013.

  1. Jeremy

    Jeremy XenForo Moderator Staff Member

    I was quickly looking for the link to BBCM today, and figured I'd click on my member card and the "Resources" count to find it... But count doesn't show on your own member card?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. Jeremy

    Jeremy XenForo Moderator Staff Member

    I meant to mention the profile. But yeah, I knew I had one. Which was the weird part. Wonder if I released another if it's come back?

    Mike, you broke it!
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    I'll flag it to Mike and he can check the DB to see what's going on.

    I could just reassign the resource (twice) which would probably fix it but it's best to leave it as is in case there is an underlying issue.
     
    Jeremy likes this.
  5. Jeremy

    Jeremy XenForo Moderator Staff Member

    I mean, I'm not too worried about it, just thought mike could fix it. :D

    You can reassign resources?
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

    Yes, it's a standard function in the RM.
     
  7. Jeremy

    Jeremy XenForo Moderator Staff Member

    I guess I should mess around with the RM more.
     
  8. Jeremy

    Jeremy XenForo Moderator Staff Member

    Looked into it just to see if it was a weird check ({$user.resource_count} > 1 or something), but it just checks for the existence of the variable (so mine should be 1) and hence, for a truthy value, which 1 is. I'm stumped... I'll try to break it tonight. :unsure:
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    It's a problem with your record in the DB, it's showing a count of 0 for some reason.
     
  10. Jeremy

    Jeremy XenForo Moderator Staff Member

    I figured. Still gonna try to break it when I'm at home to see if I know the issue. (the following is a moment of pure "aha" thought process... ignore the randomness) Actually, I may know the underlying issue! I'd have to test it some, but I know BBCM was deleted at one point for a reported security flaw, and restored. Possibly caused by this block of code in XenResource_DataWriter_Resource::_resourceMadeVisible:
    PHP:
            if ($this->get('user_id') && $this->get('resource_state') == 'visible')
            {
                
    $this->_db->query('
                    UPDATE xf_user
                    SET resource_count = resource_count + 1
                    WHERE user_id = ?
                '
    $this->get('user_id'));
            }
    Without a proper test instance (I'm at work), I can't verify this. Shouldn't $this->get('user_id') be $this->getExisting('user_id') since the resource was previously available and in existence?
     
    Brogan likes this.
  11. Mike

    Mike XenForo Developer Staff Member

    Actually the issue may well have been the undelete, as we did do an undelete once from the DB directly (before the RM had that function), which would've triggered this.
     
    Brogan and Jeremy like this.
  12. Jeremy

    Jeremy XenForo Moderator Staff Member

    I love when my "Aha!" moments have some kind of real basis to them... Now if only I had the desire to apply that to my work projects right now (but having the RM code up actually makes it look like I'm doing something... :sneaky:).
     

Share This Page