How to use it
- Open Bricks > Kiln and turn on Site: login and logout redirects.
- Open the module's settings under its row.
- Enter a URL in After login, After registration and After logout. Leave a field empty to keep the default for that event.
- To send a role somewhere else, enter a URL next to that role under By role. It applies to login and registration, and the first role in the list that the user has wins.
- Save the page.
You can enter a full URL or a path such as /my-account/.
Where it appears in Bricks
Only in Bricks > Kiln, under the module's row. The module adds no builder controls. It changes where WordPress
and WooCommerce send people after the login form, the registration form and the logout. After registration
covers WordPress' own registration form (wp-login.php?action=register) and WooCommerce's.
Kiln does not change the Login and Registration actions of the Bricks Form element. On those forms, use the form's own Redirect action.
How it works with "log in to continue" links
A link that asks for its own destination keeps it. This covers WordPress login links with a redirect_to
address, and WooCommerce login forms that carry a redirect. Your URL applies when nothing else asked for a
destination. WordPress' default of the admin dashboard counts as no request.
Limits
- Only URLs on your own site, or on a host WordPress allows for redirects, are saved. Any other URL is cleared when you save.
- Roles apply to login and registration. Logout uses the After logout URL for everyone.
- A role URL beats the site-wide URL. A user with several roles gets the URL of the first of their roles in the list.
- After registration, the role rule applies when the new user is logged in at that point. Otherwise the After registration URL is used.
- On WordPress' own registration form the new user is never logged in yet, so By role does not apply there. Only the site-wide After registration URL does. People go straight to that page instead of WordPress' "check your email" screen, so say on the page that their password link is in their inbox.
- Bricks' own
bricks/auth/custom_*_redirectfilters choose which page replaces wp-login.php. They do not set where a user goes afterwards, so Kiln does not use them.
Settings
Under the module's row in Bricks > Kiln:
- After login, After registration, After logout: one URL each.
- By role: one URL field for each role on your site.
For developers: the kiln/auth/redirect filter changes the URL Kiln picks. It receives $url (Kiln's choice,
empty to keep the default), $event (login, register or logout), $fallback (the URL used otherwise; empty on WordPress' registration form) and
$user (a WP_User, or null). Return an empty string to keep the default.
The module is off by default because it changes behavior as soon as you fill in a URL.
Requirements
Bricks 2.4 or newer. WooCommerce is not required. The WooCommerce login and registration forms are covered when WooCommerce is active.