Technology ramblings of a pro breaker and fixer.
Categories

Fix Magento Reset Password Error – Fatal error: Call to a member function setCustomerId()

We recently had users report issues when resetting their password via the magento customer area.

The error message users were getting was:

Fatal error: Call to a member function setCustomerId() on a non-object in /app/code/core/Mage/Customer/controllers/AccountController.php on line 587

Technical breakdown

When a user resets their password a series of functions are called, certain parameters of this process are included in magento theme and config files.

In this case , in a previous magento update the custom magento theme had not been update to include new password reset functions.

The Fix

There’s actually a couple of options here.

1. Update Your customer.xml

You can update your custom themes customer.xml config file (/app/design/frontend/<your_theme_package>/<your_theme_name>/layout/customer.xml) with the new functions

<customer_account_resetpassword translate=”label”>

<label>Reset a Password</label>
<remove name=”right”/>
<remove name=”left”/>
<reference name=”head”>
<action method=”setTitle” translate=”title” module=”customer”>
<title>Reset a Password</title>
</action>
</reference>

<reference name=”root”>
<action method=”setTemplate”>
<template>page/1column.phtml</template>
</action>
<action method=”setHeaderTitle” translate=”title” module=”customer”>
<title>Reset a Password</title>
</action>
</reference>

<reference name=”content”>
<block type=”customer/account_resetpassword” name=”resetPassword” template=”customer/form/resetforgottenpassword.phtml”/>
</reference>

</customer_account_resetpassword>

1. Delete Your Custom customer.xml

If your theme doesn’t include any specific custom config or layout settings you can safely delete your customer.xml file located at /app/design/frontend/<your_theme_package>/<your_theme_name>/layout/customer.xml

If you delete this file magento will load the default config options (with the updates) from the factory default magento theme.  /app/design/frontend/base/default/layout/customer.xml

Remember to flush / refresh your magento config via teh administration area, this will force the customer.xml file to be reloaded. Let us know if this fix helps you.

Leave a Reply