Revision: 63331
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 26, 2013 21:45 by magefreak
Initial Code
require "app/Mage.php";
umask(0);
Mage::app();
$collection = Mage::getModel('log/visitor_online')->prepare()->getCollection();
//Get all the customers that are logged in......
foreach($collection->getData() as $cust) {
echo 'Customer ID: '.$cust['customer_id'] . '<br/>';
echo 'Last URL visited: '.$cust['last_url'] . '<br/>';
echo 'First visit: '.$cust['first_visit_at'] . '<br/>';
echo 'Last visit: '.$cust['last_visit_at'] . '<br/>';
echo '======================<br/>';
}
//Get any particular customer, if he's currently logged in or not.....
$collection->addFieldToFilter('customer_id', 5)->addCustomerData(); //5 is customer ID of customer you want to check
if($collection->count()) {
echo 'Customer is logged in';
} else {
echo 'Customer is NOT logged in';
}
Initial URL
http://ka.lpe.sh/2013/04/25/magento-check-if-any-particular-customer-is-currently-logged-in/
Initial Description
- Check if any particular customer is currently logged in or not. - Get all the logged in customers with their recent activity. - Courtsey: <a href="http://ka.lpe.sh">http://ka.lpe.sh</a>
Initial Title
Check if any particular customer is logged in or not
Initial Tags
magento
Initial Language
PHP