Problem/Motivation

Hooks make the implementation details hard to reliably override. This change allows other modules to create another service to subclass/override methods defined in your module.

My specific use case is around the user query. I only wanted to count certain roles to be able to be registered.

Proposed resolution

The proposed patch moves the implementation details into a service which allows others to override.

Remaining tasks

-

Other changes

I applied the patch in 2997455 (to align with good coding standards)
I also updated how the users are queried using an entity query approach versus the SelectInterface.

Comments

bbeversdorf created an issue. See original summary.

bbeversdorf’s picture

StatusFileSize
new12.49 KB
bbeversdorf’s picture

StatusFileSize
new12.67 KB
bbeversdorf’s picture

StatusFileSize
new12.7 KB
bbeversdorf’s picture

StatusFileSize
new13.58 KB

Here is a new patch that is a little cleaner implementation (keeping the form alter logic in the hooks and moving the business logic to the service).

bbeversdorf’s picture

StatusFileSize
new13.42 KB
mediabounds’s picture

Status: Active » Needs review
StatusFileSize
new12.87 KB

Make a minor change to the previous patch to resolve a WSOD if the limit field is left empty on the user settings screen.

mediabounds’s picture

StatusFileSize
new12.95 KB
new1.12 KB

Found two additional issues which are resolved in this updated patch:
a. A type annotation in the new service had an extra semicolon on it
b. The submit handler in the form alter is replacing the built-in submit handler (this is an issue in the current version of the module too)

heykarthikwithu’s picture

Assigned: Unassigned » heykarthikwithu
heykarthikwithu’s picture

Assigned: heykarthikwithu » Unassigned
Status: Needs review » Fixed

Thank you @bbeversdorf & @mediabounds.

I have added the changes to the 2.0.x branch - https://git.drupalcode.org/project/user_registration_limit/-/commit/3e68fb02f34cb99013ba39a778c15ccfe759600d

Additional changes:
1. Minor issue with the accessCheck(FALSE) of the entity query is Fixed.
2. Updated the Readme with the details of module usage.

Will be released in the upcoming release.

heykarthikwithu’s picture

Released in the 2.0.0 version

Status: Fixed » Closed (fixed)

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