Problem/Motivation

The module checks for hardcoded "/user" paths in lots of conditionals which means if the user route has been altered the module doesn't work as expected (for example, it checks whether it is on a '/user/register/{rid}' and '/user/{user}/edit' path to decide which form modes to check etc.).

Steps to reproduce

  1. Install a module such as "Rename Admin Paths"
  2. Change the user path to something like "account"
  3. Install "Multiple registration module", whitelist a role, add a registration path and use a custom form display mode
  4. Visit the registration path. This will lead to a 404 unless you manually change "user" in the url to "account"
  5. Change the URL to "account" and visit your registration page, and it will not show the desired form mode

Proposed resolution

Where the module checks for "user" paths, use route checks instead.

Remaining tasks

  • Update the .module file to check for routes rather than paths

User interface changes

None.

API changes

Tweaks to conditionals in module functions.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

littlepixiez created an issue. See original summary.

littlepixiez’s picture

Sorry about the terrible branch name... It's my first time using this new workflow on d.o!

I've done a commit changing the checks for the "/user" paths and used a route name check instead. It's all working as expected for me: the URLs are going to the correct rewritten registration paths and using the correct form display modes.

I guess my one question is whether this should remain hardcoded...

  /**
   * Path pattern.
   */
  const MULTIPLE_REGISTRATION_SIGNUP_PATH_PATTERN = '/user/register/';

Which I think it probably can, as it's up to other modules to deal with the rewriting of this path, but I'm not sure.

PS. Thanks for the awesome module! I hope my use case can help others!

littlepixiez’s picture

Status: Active » Needs review

ysamoylenko made their first commit to this issue’s fork.

ysamoylenko’s picture

Status: Needs review » Reviewed & tested by the community

Hello @littlepixiez,

Thank you for your contribution. Your changes make sense. They will be merged soon.

ysamoylenko’s picture

Status: Reviewed & tested by the community » Fixed

The changes were merged.

ysamoylenko’s picture

The changes were merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.