Get user group id in Joomla with PHP -


to user group id in joomla 2.5.15, followed documentation in joomla documentation here

my code looks this:

$user = jfactory::getuser(); echo "<p>your group id {$user->gid}.</p>"; 

but code producing error: notice: undefined property: juser::$gid in without group id in output.

try using this:

$user   = jfactory::getuser(); $groups = $user->get('groups');  foreach ($groups $group) {     echo '<p>group = ' . $group . '</p>'; } 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -