Viewing ID of organic group? I am trying to display the ID of the group the user is currently viewing. I created a block, and added the following PHP code into it:

&lt;?php
$group = og_context();
if ( !empty($group) ) {
   print "$group-&gt;nid";
}
?&gt;


Problem is, when I run it, I get the following error:

Notice: Trying to get property of non-object 

Any idea why this is happening, and how to fix it? Seems like it should be easy enough of a task.
In Drupal 7 the NID is the group ID so you could just output $node->nid.