is it possible to load customer model using only token?

One of my method generate a token this way:

$token = Mage::helper('customer')->generateResetPasswordLinkToken();

and my second method takes this token in argument. Based on that i have to get customer model beacuse i want to change his password.

  • According to your code, you should already have the customer stored in the $customer variable. – Raphael at Digital Pianism Feb 15 '16 at 13:17

After rereading your post, I reckon the only way of doing it by using collection:

$customerCol = Mage::getResourceModel('customer/customer_collection')->addFieldToFilter('rp_token',$token)->setPageSize(1);

$customer = $customerCol->getFirstItem();
| improve this answer | |
  • Could you explain me why it is necessary to call setPageSize method? – Wojciech Ka Feb 16 '16 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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