Problem/Motivation
I want to add functionality to set author information for a replicated page to the current user. I am not sure I understand how to use this module; if we want additional functionality, do we look to update this module? Or do we just add appropriate code to our own custom module?
Steps to reproduce
Replicate a page authored by someone other than yourself. Note replicated page maintains original author account.
Proposed resolution
Set the author to the current active user when replicating content.
Remaining tasks
Report mistakes in the associated issue fork.
User interface changes
None. Potentially a checkbox in the Replicate admin form if this is to be made a configurable change.
API changes
NA.
Data model changes
NA.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3544472-add_change_author_functionality-10.patch | 6.18 KB | byronveale |
Issue fork replicate_actions-3544472
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
Comment #2
byronveale commentedComment #3
ruslan piskarovHey @byronveale.
I think you can use hook_form_alter() in your custom module.
Example:
Or implement your own EventSubscriber:
class ReplicateChangeAutor implements ReplicateSetEntityEdit.However, if you can create a patch, I will add this functionality to the module. I think it is a great idea.
Comment #5
byronveale commentedThanks @ruslan, I created a merge request here.
I also added a patch to this comment.
Any questions, do let me know…
Comment #6
ruslan piskarov@byronveale, brilliant. I am going to review tomorrow. Thank you.
Comment #7
ruslan piskarovComment #8
vinodhini.e commentedHi, Steps to Reproduce the Issue and Verify the Fix
Tested on Drupal 11.2.3.
Installed and enabled Replicate and Replicate Actions modules.
Created two users:
User A → can create content
User B → can replicate content
Logged in as User A and created a Page (/node/add/page).
Logged in as User B, went to the Page created by User A, clicked Replicate, and saved the replicated page.
Before applying the patch: The replicated page author was User A (original author).
Applied MR !12, cleared cache with drush cr, and repeated the same steps.
After applying the patch: The replicated page author is now User B (replicating user).
Its working fine. Thanks.
Comment #9
bkosborneComment #10
byronveale commentedUpdated merge request based on code review (thanks @bkosborne), attaching updated patch too.
Comment #11
ruslan piskarovThank you @byronveale, @bkosborne and @vinodhini.e.
Merget to master.
Created 8.x-1.8.