Magento: Get Customer Attribute

This article contains code snippet to get customer attributes in Magento.

Get Customer Collection


$collection = Mage::getResourceModel('customer/customer_collection');

Get Customer’s Name in Customer Collection


$collection = Mage::getResourceModel('customer/customer_collection')
                ->addNameToSelect();

Get Custom Attribute in Customer Collection


$collection = Mage::getResourceModel('customer/customer_collection')
                ->addAttributeToFilter('your_attribute_code', array('notnull' => true));

Thanks.