New User Activation by email - change activate_redirect
Created 6 years ago by kiltedup

Afternoon,

Is there a way to change the redirect after a new user activates their account from email notification they receive?

The code seems to look for a form builder option 'activate_redirect' :

$activator->send($user, $this->builder->getFormOption('activate_redirect', '/'));

But try as I may to use the register form, I can't seem to set this option. Want to use this in the twig : {{ form('register').redirect(request_get('redirect', '/'))|raw }} but set this activate_redirect value somewhere!

Anyone done this / have any suggestions?

TIA

Dave

ryanthompson  —  6 years ago Best Answer

Try adding ...activateRedirect('example/redirect')... this to your Twig criteria chain there. Methods that are not found automatically set option values using the snake case of the method. You can likely do ...setOption('activate_redirect', 'example/redirect')... as well cause that method actually exists on the builder. Which - you are not using the builder but a safe wrapper for the builder. So public methods pass through!

kiltedup  —  6 years ago

Ah - just sorted it. Forgot you could just magically set the option .....

{{ form('register').activate_redirect('/go/to/the/pub').redirect(request_get('redirect', '/'))|raw }}

ryanthompson  —  6 years ago Best Answer

Try adding ...activateRedirect('example/redirect')... this to your Twig criteria chain there. Methods that are not found automatically set option values using the snake case of the method. You can likely do ...setOption('activate_redirect', 'example/redirect')... as well cause that method actually exists on the builder. Which - you are not using the builder but a safe wrapper for the builder. So public methods pass through!

ryanthompson  —  6 years ago

Lol you beat me to it! My answer is better 😛

kiltedup  —  6 years ago

I had originally used setOption but that didn't work ( just tried it again and still doesn't )

But now using activateRedirect(....) ...... and have amended the best answer 😄

Cheers

Dave

ryanthompson  —  6 years ago

Ill check out the setOption cause that should certainly work!