Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Save user(s)' action #5656

Open
ghost opened this issue Jun 22, 2022 · 2 comments
Open

Add 'Save user(s)' action #5656

ghost opened this issue Jun 22, 2022 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 22, 2022

Description of the need

When some code is run in hook_user_presave(), an easy way to bulk update user accounts would be to use the actions at the top of /admin/people/list. However there's not currently an action to save the user account (to trigger this hook).

Proposed solution

Add an action that simply saves the user account(s), triggering the presave hook.

Alternatives that have been considered

An alternate solution is to use the 'Block user(s)' action. That triggers the presave hook, but then you need to unblock the users again. That triggers (by default) an email to be sent to users, and could be problematic if you'd prefer to have these changes made without triggering emails to be sent...

Draft of feature description for Press Release (1 paragraph at most)

Backdrop now includes a 'Save user(s)' action.

@ghost
Copy link
Author

ghost commented Jun 22, 2022

Here's a PR: backdrop/backdrop#4099

@argiepiano
Copy link

argiepiano commented Jun 22, 2022

Unless I'm missing something, this seems to me like a rather fringe and circuitous use of save (saving something only to trigger a presave hook). From a developer point of view, I feel inclined to say that if someone needs to run a specific process at will on an entity, they should create a custom action that runs that process.

However, I can see how a developer may benefit from a contrib module that invokes specific hooks for entities - this done without actually saving the entity, but only invoking specific hooks with those entities. This could be helpful for debugging (though I would probably use Devel to run these hooks manually).

As a side note, Views Bulk Operations contains a "Modify entity values" that could be used to just save entities without modifying anything, thus triggering all hooks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant