cancel
Showing results for 
Search instead for 
Did you mean: 

Override Magento\Customer\Controller\Account\CreatePost

Override Magento\Customer\Controller\Account\CreatePost

Hi,

I added custom input in registration form (override template is ok) and I want to add a custom check on this input (call API to get an ID...).

I want override Magento\Customer\Controller\Account\CreatePost but it's don't work.

I added di.xml in MyNameSpace/MyModuleName/etc and a custom CreatePost.php in MyNameSpace/MyModuleName/Controller/Action

 

Capture d’écran 2018-09-21 à 15.26.57.png

Any idea??? I've follow this tutorial -> https://www.magestore.com/magento-2-tutorial/magento-2-controller-override-tutorial/

5 REPLIES 5

Re: Override Magento\Customer\Controller\Account\CreatePost

Re: Override Magento\Customer\Controller\Account\CreatePost

Please use 'plugin' instead of 'preference' as it's been used in this:

https://magento.stackexchange.com/questions/230588/how-to-override-contact-us-post-action-using-plug...

 

 

---
If you've found my answer useful, please give"Kudos" and "Accept as Solution"

Re: Override Magento\Customer\Controller\Account\CreatePost

Hi @JoouulDev

 

I found that   https://webkul.com/blog/overriding-rewriting-classes-magento2/

kindly check this link and follow these steps

 

 

 

------------

If you've found one of my answers useful, please give"Kudos" or "Accept as Solution"

Re: Override Magento\Customer\Controller\Account\CreatePost

@syedhasan I did the same thing but don't work

Re: Override Magento\Customer\Controller\Account\CreatePost

Hi @JoouulDev

Now you can follow these steps to override to customer CreatePost file.

 

Step 1.

create two files in a etc folder 1) di.xml 2) module.xml
MyNameSpace/MyModuleName/etc/di.xml
MyNameSpace/MyModuleName/etc/module.xml

Step 2.
create file registration.php in MyNameSpace/MyModuleName/
MyNameSpace/MyModuleName/registration.php

Step 3.
create controller folder like this
MyNameSpace/MyModuleName/Controller/Account/CreatePost.php

after add these files now you run command
i) php -dmemory_limit=1024M bin/magento setup:upgrade
ii) php bin/magento cache:clean
iii) sudo chmod -R 0777 pub/ var/

 

 

 

------------------------------------------------
If you've found one of my answers useful, please give"Kudos" or "Accept as Solution"