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

Jeremy

in memoriam 1991-2020
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?
 
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!
 
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.
 
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:
 
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?
 
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.
 
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:).
 
Top Bottom