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

Allow bulk edit of coauthors #747

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

TheCrowned
Copy link
Contributor

Fixes #551.

Bulk edit of coauthors has been disabled for a long time. This PR finishes work initiated by psaikali@2ac1afb and makes it fully working, by actually updating the coauthors on bulk edit actions.

Screenshot from 2020-10-03 21-29-06

@rebeccahum
Copy link
Contributor

Thanks for this, @TheCrowned!

In my brief testing, I ran into this fatal when attempting to delete a post:

Notice: Undefined index: post in /public_html/wp-content/plugins/Co-Authors-Plus/co-authors-plus.php on line 571

Warning: Invalid argument supplied for foreach() in public_html/wp-content/plugins/Co-Authors-Plus/co-authors-plus.php on line 571
Error in moving the item to Trash.

@rebeccahum
Copy link
Contributor

@lschuyler Did you want to attempt to refresh this abandoned PR?

Return `$post_data` in `theaction_bulk_edit_update_coauthors` function to prevent undefined errors.

`wp_insert_post_data` is a filter so we need to return a value. When we aren't bulk editing, the `action_bulk_edit_update_coauthors` function still fires on every post data insert, so we need to return the value of the post data when we exit it early in L621 to prevent the undefined warnings.

Also simplified the text instructions for the author bulk edit to emphasize that all previous authors are removed when new authors are added.
@lschuyler
Copy link
Contributor

@rebeccahum: I've fixed the errors that were occurring here and the tests all pass again.

I'm not wild on the idea that action_bulk_edit_update_coauthors has to run on every wp_insert_post_data regardless of it is bulk-edit related. We check for other events and bail out of the function if not relevant (ie not bulk-edit related) but I wish there was a better way. As mentioned in this comment there is a core trac ticket that could help but it appears abandoned.

@WoodyPad
Copy link

Hi, thank you for your work and commitment.
I wanted to know is there a usable version for bulk editing.
Currently the version on wordpress.org does not make the change in bulk, here it seems that you have succeeded.

Thank you

@WoodyPad
Copy link

WoodyPad commented Jul 26, 2022

Hello everybody,
does this fix work? i have to use it on a live site.

I installed on a Test site, but I still don't see the authors box.
Thank you

@tuan-be
Copy link

tuan-be commented Dec 26, 2022

I only pick the changes of 3 files on this pull request, and it works as my expectation.
Tested on WordPress 6.1.1
Thank you very much, and I hope this pull request is able to merge as soon as possible

@gamebits gamebits requested a review from leogermani May 22, 2023 01:00
@GaryJones GaryJones modified the milestones: 3.5.12, 3.6 Jul 24, 2023
@GaryJones GaryJones changed the base branch from main to develop August 25, 2023 15:22
@alecgeatches alecgeatches modified the milestones: 3.6, 3.7 Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CAP removes the Author field in bulk edit actions
8 participants