Keyword

How to pass author id in onK2UserDisplay

More
14 years 10 months ago #76781 by Gabe
So I've been modifying a k2 plugin released by Jooblogs for JomSocial integration. It's in these forums somewheres..

So far everything is going great. Reworked to use JomSocial's mini-header. This works perfectly for article display, but fails during k2 user page display.

This is the function I am using in the plugin:

function onK2UserDisplay( & $user, & $params, $limitstart) {
// prepare JSUser for all actions
$jsUserObject =& CFactory::getUser($user);

$html = '';
// BEGIN User Stats Block
$objUserStats = new JBSJSUserStatsBlock($jsUserObject);
// BEGIN Main Stats div
if ( $this->pluginParams->get ('userminiheader', 0) == 1 ) { $html .= $objUserStats->getMiniHeaderBlock(); } else {
$html .= ''; if ( $this->pluginParams->get ('userstatus', 0) == 1 ) $html .= $objUserStats->getUserStatusBlock();
if ( $this->pluginParams->get ('usersonline', 0) == 1 ) $html .= $objUserStats->getUserOnlineBlock();
if ( $this->pluginParams->get ('userfriendscount', 0) == 1 ) $html .= $objUserStats->getUserFriendsCountBlock();
if ( $this->pluginParams->get ('usergroups', 0) == 1 ) $html .= $objUserStats->getUserGroups();
if ( $this->pluginParams->get ('usersendmessage', 0) == 1 ) $html .= $objUserStats->getUserSendMessageBlock();
$html .= '
'; }
// END Main Stats div
// END User Stats Block

// BEGIN Gallery Block
if ( $this->pluginParams->get ('showgallery', 0) == 1 ) $html .= JBSJSGalleryBlock::getBlock($jsUserObject->id); // Standardalone Block
// END Gallery Block

$html .= '
';
return $html;
}

To me, that looks like it should work. The problem is that the wrong user id is passed along in the function during k2 profile page display, and it shows the miniheader for the logged in user instead of the authors page.

Any help at all please?

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #76782 by Gabe
Replied by Gabe on topic How to pass author id in onK2UserDisplay
Figured it out.

Used this:

function onK2UserDisplay( & $user, & $params, $limitstart) {
global $mainframe;
// prepare JSUser for all actions
$id = JRequest::getVar("id",0);
$jsUserObject =& CFactory::getUser($id);

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum