Thought I'd share this code that detects what group id the user is a part of.
Really useful for adding Login and Log Out menu items, but hiding the latter when logged in.
Add this to your template index.php page:
$user = JFactory::getUser();
$groups = $user->get('groups');
if (is_array($groups)) {
foreach($groups as $group) {
//echo "
Your group ID is:" . $group . "
";
} }
then before tag, add some CSS inside PHP tags to hide the item id of the menu for Login:
if ($group >= 2) echo "li.item206 { display: none !important; }";