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

Migrating from custom system, and not able to keep the order in authors. Wrong sorting. #1052

Open
manuelRod opened this issue Jun 12, 2024 · 2 comments

Comments

@manuelRod
Copy link

manuelRod commented Jun 12, 2024

Hello,

We are currently migrating from another custom system to co-authors.
We are having a lot of trouble with the migration since the ordering of authors seems to be completely random.
Sometimes (most of the time) respects the old order, but sometimes it doesn't.
Maybe the way we are doing it it's wrong (?)

How are we doing it?
Passing an array of authors (with user_nicename) to add_coauthors function.

global $coauthors_plus;
$new_co_authors = [ 'Jhon Doe', 'Test User'];
$coauthors_plus->add_coauthors( $post_id, array_map( 'sanitize_title', $new_co_authors ) );

Sometimes we will get co-authors in the right other, sometimes inverse.

Why the order is sometimes not respected? I tried other combinations, like calling add_coauthors with just one author, n times. Nothing seems to work, and all the time seems random.

Any clues? Are we doing it wrong?

Thanks,

@manuelRod manuelRod changed the title Migrating from other system, and not able to keep the order. Wrong sorting. Migrating from custom system, and not able to keep the order in authors. Wrong sorting. Jun 12, 2024
@bystrzan
Copy link

Regular posts also doesn't respect the sorting option from post editing screen (gutenberg + hybrid theme)

@manuelRod
Copy link
Author

@bystrzan While I was debugging this issue, I noticed that the AJAX call made in the post editor also uses add_coauthors.
Meaning, as you mentioned, sometimes the order won't be respected also using the plugin itself.

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

No branches or pull requests

2 participants