for reference
JomSocial 3rd party component integrationSupport JomSocial Messaging
$jspath = JPATH_ROOT.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');
include_once($jspath.DS.'libraries'.DS.'messaging.php');
// Add a onclick action to any link to send a message
// Here, we assume $usrid contain the id of the user we want to send message to
$onclick = CMessaging::getPopup($userid);
echo '<a href="javascript:void(0)" onclick="'. $onclick .'">Send message</a>';
Using JomSocial avatar
$jspath = JPATH_ROOT.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');
// Get CUser object
$user =& CFactory::getUser($userid);
$avatarUrl = $user->getThumbAvatar();
echo '<img src="'. $avatarUrl .'"/>';
Getting a user's friend count
$jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
include_once($jspath. DS . 'libraries' . DS . 'core.php');
// Get CUser object
$user = CFactory::getUser( $userid );
$count = $user->getFriendCount();
echo '<span>Total friends: ' . $count . '</span>';
Getting a user's status
$jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
include_once($jspath. DS . 'libraries' . DS . 'core.php');
// Get CUser object
$user = CFactory::getUser( $userid );
$status = $user->getStatus();
echo '<span>User Status: ' . $status . '</span>';
Getting a user's display name
$jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
include_once($jspath. DS . 'libraries' . DS . 'core.php');
// Get CUser object
$user = CFactory::getUser( $userid );
$name = $user->getDisplayName();
echo '<span>User name: ' . $name . '</span>';
Get user's online status
$jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
include_once($jspath. DS . 'libraries' . DS . 'core.php');
// Get CUser object
$user = CFactory::getUser( $userid );
$isOnline = $user->isOnline();
if( $isOnline )
{
echo '<span>User is online now!</span>';
}
Get user's view count
$jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
include_once($jspath. DS . 'libraries' . DS . 'core.php');
// Get CUser object
$user = CFactory::getUser( $userid );
$count = $user->getViewCount();
echo '<span>Views: ' . $count . '</span>';
Link to user personal profile page
$jspath = JPATH_ROOT.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');
// Get CUser object
$link = CRoute::_('index.php?option=com_community&view=profile&userid='.$userid);
echo '<a href="'. $link .'">View user profile</a>';