I am creating a new module for Facebook Login (no i dont want to use the existing ones) and I am attempting to access/extend the core AccountController.php actions while also adding a new action. The reason I want to extend the AccountController.php class is because I want to register the Facebook user in my custom action and then use some of the functions in the core.
When a user registers, magento uses loginPostAction(). When my Facebook user registers I want to use fbLoginPostAction() in my own AccountController.php in my module and then call some functions in the core AccountController.php.
- $this->_dispatchRegisterSuccess($customer);
- $this->_successProcessRegistration($customer);
I've tried several variations but I can't seem to extend the core account controller AND add my custom action. I've been able to extend it and overwrite the existing.
I need to call these functions as I need to dispatch the event after the customer registers.
Am I going about this the right way?
<?xml version="1.0"?>
<config>
<modules>
<ModEgo_Facebooklogin>
<version>0.1.0</version>
</ModEgo_FacebookLogin>
</modules>
<frontend>
<routers>
<customer>
<args>
<modules>
<modego_facebooklogin before="Mage_Customer">ModEgo_Facebooklogin</modego_facebooklogin>
</modules>
</args>
</customer>
</routers>
</frontend>
</config>
app/code/local/ModEgo/Facebooklogin/controllers/AccountController.php
<?php
require_once Mage::getModuleDir('controllers', 'Mage_Customer').DS.'AccountController.php';
class ModEgo_FacebookLogin_AccountController extends Mage_Customer_AccountController
{
public function fbLoginPostAction() {
// this new action wont work
echo 'hey';
}
public function loginPostaction() {
// this works
echo 'hey2';
}
}