I needed to create some custom shipping functionality within Magento today which would charge wholesale customers $5.00 flat rate, and all other customers got free shipping. This required having to access the customer group number. Wholesale customers are have a group id of 2.
So, I wrote a simple if statement in /template/checkout/onepage/shipping_method/available.phtml to check.
You may also want to simply check if users are logged in or not but don’t really need their customer group number. Here is how you can easily access this information from anywhere:
Check if User is Logged In
# Returns boolean
$logged_in = Mage::getSingleton( 'customer/session' )->isLoggedIn();
Get Customers Group ID
$group = Mage::getSingleton('customer/session')->getCustomerGroupId();