• 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

Jeremy

Well-known member
#1
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?
 

Jeremy

Well-known member
#3
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!
 

Brogan

XenForo moderator
Staff member
#4
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

Well-known member
#8
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:
 

Jeremy

Well-known member
#10
It's a problem with your record in the DB, it's showing a count of 0 for some reason.
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?
 

Mike

XenForo developer
Staff member
#11
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.
 

Jeremy

Well-known member
#12
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.
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:).