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

CAP removes the Author field in bulk edit actions #551

Open
TheCrowned opened this issue Jul 4, 2018 · 10 comments · May be fixed by #747
Open

CAP removes the Author field in bulk edit actions #551

TheCrowned opened this issue Jul 4, 2018 · 10 comments · May be fixed by #747
Milestone

Comments

@TheCrowned
Copy link
Contributor

Without CAP, it's possible to bulk edit post author:

wo cap 2

With CAP active, the field vanishes and no coauthor field is added in replacement:

w cap

@anigeluk anigeluk assigned anigeluk and unassigned anigeluk Aug 1, 2018
@psaikali
Copy link

psaikali commented Aug 2, 2018

I think we should wait to fix this issue, here's why.
I started working on a fix for that in a separate forked repo: psaikali@2ac1afb

cap-bulk-edit-coauthors
As you can see, the UI is ready.
I just need to process the bulk action when editing multiple posts, and that's where things get complicated.

The main core function taking care of this bulk editing action is bulk_edit_posts(). Unfortunately, this function does not offer any hook to let us save additional data when bulk editing.
There is a ticket for that here and it looks like the bulk_edit_posts hook will show up in 5.0 (very soon).

IMHO, it's better to wait for this official hook and use it to easily process the bulk-edit action and assign co-authors to multiple posts at the same time. I started to find another way to do that, by hooking to another action (wp_insert_post is triggered by the bulk_edit_posts() function) and checking for $_POST data, but I feel that this is a hacky way of doing things knowing that a proper hook might be available in a couple of months.

Any feedback is appreciated!

@DailenG
Copy link

DailenG commented Dec 13, 2018

Just ran into this myself. Looks like we'll have to wait for 5.0.2 for the bulk_edit_posts to be completed.

@jadlimcaco
Copy link

Is this fix still in progress?

@colorcrate
Copy link

This is still an issue as of May, 2020, any update?

@jxxe
Copy link

jxxe commented May 20, 2020

This would be so useful! Any word?

@melmo
Copy link

melmo commented Jun 9, 2020

Also looking for this update

@RubenatorX
Copy link

Bump

@TheCrowned
Copy link
Contributor Author

TheCrowned commented Sep 25, 2020

@psaikali are you still working on this? Otherwise I can take over and hopefully fix it for good :)

After all, it looks like the bulk_edit_posts action won't be a thing. But it also looks like the wp_insert_post_data hook is enough for our purpose. It does contain all the details we need to then call add_coauthors on each post ID with given authors. This is an example var_dump of the second argument of the action:

array (size=47)
...
  'ID' => int 10673
...
  'coauthorsinput' => 
    array (size=3)
      0 => string 'Giacomo Lana' (length=12)
      1 => string 'admin' (length=5)
      2 => string 'Search for an author' (length=20)
  'coauthors' => 
    array (size=2)
      0 => string 'et-1' (length=4)
      1 => string 'admin' (length=5)
  'coauthors-nonce' => string '81d49936a3' (length=10)
  'bulk_edit' => string 'Aggiorna' (length=8)
...
  'post' => 
    array (size=2)
      0 => string '10673' (length=5)
      1 => string '10633' (length=5)
  'action2' => string '-1' (length=2)
  'post_ID' => int 10673
  'user_ID' => int 1
  'filter' => string 'db' (length=2)

it looks to me the two entries coauthors and post are enough.

@tiberium84
Copy link

Tell me please, is there any news on this issue?

@RubenatorX
Copy link

Tell me please, is there any news on this issue?

You can check the PR: #747
A fix was submitted, but it causes issues so, someone has to fix the fix.

@GaryJones GaryJones added this to the 3.6 milestone Jul 28, 2023
@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 a pull request may close this issue.