Bug #2166
closedcbUser class caching causing field display issues
Description
When Username field is set not to display on profile and an integration (CB LastView) uses the cbUser class to obtain the Username, Name, and/or Avatar fields with the $reason as "list" it is resulting in the Username field suddenly being displayed again.
I do not know if is directly related to just that plugin, but have traced to the following line of code.
$cbUser = CBuser::getInstance( $lastview->viewer_id );
$name = $cbUser->getField( 'name', null, 'html', 'none', 'list' );
$username = $cbUser->getField( 'username', null, 'html', 'none', 'list' );
$avatar = $cbUser->getField( 'avatar', null, 'html', 'none', 'list' );
With the above section removed the Username field does not display on profile as configured. If the getField function is used then the Username field is suddenly displayed again (didn't seam to matter which field). I also tried using cbUser with &, but same result.
Updated by beat almost 14 years ago
- Status changed from New to Feedback
- Assignee changed from beat to krileon
Kyle,
I'm not sure how to reproduce this one.
Can you please tell me how or even better analyze and suggest a patch ?
Many thanks
Updated by krileon almost 14 years ago
- Assignee changed from krileon to beat
To reproduce
Install LastViews plugin
Set Name field (ensure CB is configured to use Name) to not display on profile
Publish LastViews Tab plugin in plugin management
Once done view profile and Name field will be visible
This happens even with GJ 2.0 and Username field
Updated by krileon almost 14 years ago
GJ 2.0 uses the below.
$cbUser =& CBuser::getInstance( $row->user );
if ( ! $cbUser ) {
$cbUser =& CBuser::getInstance( null );
}
$cbUser->getField( 'formatname', null, 'html', 'none', 'list' )
Which if not present this issue doesn't happen.
Updated by krileon almost 14 years ago
Removing $cbUser->getField( 'formatname', null, 'html', 'none', 'list' ) resolved the issue, so it seams related to calling a field through API.
Updated by krileon almost 14 years ago
FROM:
static $prefetched = null;
static $fieldsByName = null;
TO:
$prefetched = null;
$fieldsByName = null;
Within _getTabFieldsDb resolved the issue. The above change was just a test (disabled caching). Seams there's an issue with the fields cache, probably being overwritten by additional calls.
Updated by beat almost 14 years ago
I believe this issue is in lastviews tab as present with CB 1.3.1 already.
Updated by beat almost 14 years ago
- Target version changed from CB 1.4.0 to CB 1.7
Updated by beat over 13 years ago
- Status changed from Feedback to Resolved
- Assignee changed from beat to krileon
- % Done changed from 0 to 100
I believe that this one is resolved with latest CB 1.7 svn (or B1) as I have redone the caching of CB fields lists.
Kyle,
Can you please confirm it's fixed ? :)
Updated by krileon over 13 years ago
- Assignee changed from krileon to beat
Confirmed resolved using latest SVN.