Magento 1.8 – Can’t Set Observer on Customer Login

ce-1.8.1.0configurationmagento-1.8php-5.4

I'm trying to set an observer that fires on customer login and it doesn't appear to be set in magento (and therefore doesn't fire). I've debugged core files and the dispatchEvent function is being fired correctly, but my observer doesn't appear to exist in the registered events.

My code is as follows:

Foo\Bar\etc\config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Foo_Bar>
            <version>0.0.1</version>
        </Foo_Bar>
    </modules>
    <global>
        <models>
            <foo_bar>
                <class>Foo_Bar_Model</class>
            </foo_bar>
        </models>

... ... ...

        <events>
            <!-- fire on login -->
            <customer_login>
                <observers>
                    <foo_bar>
                        <class>foo_bar/observer</class>
                        <method>customerLogin</method>
                        <type>singleton</type>
                    </foo_bar>
                </observers>
            </customer_login>

... ... ...

        </events>
    </global>
</config>

Foo\Bar\Model\Observer.php

<?php
class Foo_Bar_Model_Observer extends Mage_Core_Model_Abstract
{
    public function customerLogin(Varien_Event_Observer $observer)
    {
        die('test'); // Doesn't do anything
    }

... ... ...

}

As I said before, I have about 6 other observers with basically identical configurations and methods that all work fine.

Can anyone help me out in pointing me to where I've gone wrong? Does the customer_login observer require some extra code to work correctly?

Thanks in advance!

Best Answer

<customer_login>
  <observers>
      <foo_bar> <!-- foo_bar should be unique tag for within all customer_login observers-->
          <class>foo_bar/observer</class>
          <method>customerLogin</method>
          <type>singleton</type>
      </foo_bar>
  </observers>
</customer_login>

Observer

class Foo_Bar_Model_Observer
{
    public function customerLogin(Varien_Event_Observer $observer)
    {
        Mage::log('some message here'); // Doesn't do anything
    }
}

And also check if exception.log (admin->config->developer) and developer mode (index.php) is on.