0

1) I registered my extension at app/etc/modules/Bmg_Golo.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Bmg_Golo>local</Bmg_Golo>
        <active>true</active>
    </modules>
</config>

2) My config.xml is at app/code/local/Bmg/Golo/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Bmg_Golo>
            <version>0.0.1</version>
        </Bmg_Golo>
    </modules>
    <global>
        <models>
            <Bmg_Golo>
                <class>Bmg_Golo_Model</class>
            </Bmg_Golo>
        </models>
    </global>
    <frontend>
        <events>
            <controller_action_postdispatch_customer_account_resetpasswordpost> 
                <observers>
                    <Bmg_Golo>
                        <class>Bmg_Golo/observer</class>
                        <method>logout</method>
                    </Bmg_Golo>
                </observers>
            </controller_action_postdispatch_customer_account_resetpasswordpost>
        </events>
    </frontend>
</config>

3) I created an observer at app/code/local/Bmg/Golo/module/Observer.php

<?php
/**
* 
*/
class Bmg_Golo_Model_Observer
{
    public function logout($observer) {
        $session = Mage::getSingleton('customer/session');
            if ($session->isLoggedIn()) {
                Mage::getSingleton('customer/session')->logout();
            }
    }

}
?>

Now when i log in as customer and change password. Its not logging out

6
  • More appropriate solution would be to observe predispatch event on controller rather than allow to login only to logout right after. It makes no sense at all. Commented Nov 14, 2017 at 18:29
  • I am new to magento It will be great if you tell me in detail Commented Nov 14, 2017 at 18:46
  • Should it be like this? <frontend> <events> <controller_action_predispatch> <observers> <bmg_golo> <type>model</type> <class>bmg_golo/observer</class> <method>logout</method> </bmg_golo> </observers> </controller_action_predispatch> </events> </frontend> Commented Nov 14, 2017 at 19:19
  • Have you not just tried to clear the session completely e.g. Mage::getSingleton('core/session')->clear(); which should kill off all sessions include customer and they will need to login again Commented Nov 14, 2017 at 21:45
  • I think my observer method is never been called :( Commented Nov 15, 2017 at 1:43

1 Answer 1

1

Please check that your code in app/etc/modules/Bmg_Golo.xml file is not correct.

It should be like this:

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <modules>
    <[Package]_[Module]>
      <active>true</active>
      <codePool>local</codePool>
    </[Package]_[Module]>
  </modules>
</config>

Apart from that rest of the code is looking fine.

Please let me know if it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.