I am making a JomSocial plugin to get name of the user but when I echo the name it is not displaying the name. Here is my code
<?php
defined('_JEXEC') or die('Restricted access');
require_once JPATH_ROOT .'/components/com_community/libraries/core.php';
class plgCommunityName extends JPlugin{
function getUserDetails(){
$cuser = CFactory::getUser();
$name = $cuser->username;
echo $name;
}
}
?>
How can I do this ?
Try to return $name; instead of echo $name;