I am using Joomla and JomSocial to develop a social platform.
JomSocial comes with some codes in the documentation, that allows me to retrieve certain information about the JomSocial user.
For example:
If i want to retrieve the JomSocial User Name, i can use this code here >
<?php
include_once JPATH_ROOT.'/components/com_community/libraries/core.php';
// Get CUser object
$user = CFactory::getUser( $userid );
$name = $user->getDisplayName();
echo ' '.$name ;
?>
The above code will display the JomSocial User Name for the currently logged in user.
Another example:
If i want to retrieve the JomSocial User Friend Count, i can use this code here >
<?php
include_once JPATH_ROOT.'/components/com_community/libraries/core.php';
// Get CUser object Friend Count
$cuser = CFactory::getUser();
$data = $cuser->getFriendCount();
echo $data;
?>
The above code, will display the number of friends for the currently logged in viewing user.
I use these codes, and add them into my custom Joomla template, to build a user dashboard area for my users, so my users can monitor their various activities on my website.
I would like also, to be able to display to my users their JomSocial Group Count.
For example:
If Joe Blogs has joined 4 JomSocial Groups. I need the code that would display the data count of: 4
How to get the JomSocial User Group Count ?
I have looked through the JomSocial Documentation, and it does not provide an answer to this particular question. It does explain:
There are several ways you can retrieve the user object which is going to be manipulated. The basic way to retrieve the currently logged in user is shown below. If no one is logged in, it will return "guest" object.
$cuser = CFactory::getUser();
Thank you for your help and support.