- Issue created by @linhnm
- Status changed to Needs review
11 months ago 7:06am 25 December 2023 - Status changed to RTBC
11 months ago 6:47pm 26 December 2023 - 🇦🇷Argentina tguerineau
Hi,
I have conducted testing, in drupal 10, on the patch submitted:
allow-altering-the-redirect-url-success-3410776-3.patch
. Here are the details of my testing process and findings:Setup and Configuration:
- Applied the provided patch to the multi_domain_login module.
- Configured the module settings.
- Tested with various user roles, including Editor and Administrator.
The patch works as intended, successfully allowing the alteration of the redirect URL based on user roles. The implementation aligns well with Drupal's hook system and provides the desired flexibility for redirecting users post-login, based on their roles.
- Status changed to Postponed: needs info
10 months ago 11:18am 26 January 2024 - 🇧🇪Belgium kriboogh
There is already a possibility to alter the url right before the redirect happens using:
function my_module_multi_domain_login_url(&$url, &$domain) { // Alter $url here. }
If you need more control, it is also possible to write a configuration override in your custom module and make it cache dependent on the user.
namespace Drupal\my_module\Config; class MyModuleOverrides implements ConfigFactoryOverrideInterface { /** * {@inheritdoc} */ public function loadOverrides($names) { $overrides = []; if (in_array("multi_domain_login.settings", $names)) { // Do custom stuff here to determine the $url. $overrides["multi_domain_login.settings"] = [ 'redirect_success' => $url, ]; } return $overrides; } /** * {@inheritdoc} */ public function getCacheableMetadata($name) { $cache = new CacheableMetadata(); $cache->setCacheContexts(['user']); return $cache; }
If this could suit your needs, please close this ticket or reset to "needs work" than we will look into it.