WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] 3.0 Doesn't Work (25 posts)

  1. osm2
    Member
    Posted 1 year ago #

    Wonderful plugin, I've used it for years.

    Unfortunately, 3.0 was not adequately tested.

    - Authors have vanished completely from post edit
    - Some authors vanish from various other places after upgrade, including from "coauthors_posts_links" output on public website!
    - thanks for adding filter to "coauthors_posts_links_single". However, this filter has no right to be escaping the HTML output in $args['text']. I had to disable "esc_html" wrapper from $args['text'] output.

    http://wordpress.org/extend/plugins/co-authors-plus/

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Sorry to hear your having trouble :( If it's any solace, v3.0 was running on dozens of WordPress.com VIP sites for a few months before being released. Yours seems to be more of an edge case than the norm.

    Authors have vanished completely from post edit

    A few questions that can help us debug further:

    • For a post that is missing its authors, are you able to reassign authors?
    • Are there any patterns as to which posts are missing authors? Are they older posts or newer posts? Have you updated them recently?
    • How many total posts have been affected?

    However, this filter has no right to be escaping the HTML output in $args['text'].

    Can you explain why the output shouldn't be properly sanitized? You can read more about why you might sanitize here.

  3. osm2
    Member
    Posted 1 year ago #

    Thank you for your reply, and your excellent plugin. I've used it for a while. It's dependable and works brilliantly.

    For a post that is missing its authors, are you able to reassign authors?

    Most co-authors are successfully echoed in the list of posts (edit.php), but for any post edited, no longer do I see any co-authors (nor author) module anywhere in the post edit page (post.php?action=edit). So I am not able to re-assign any author or co-authors for any posts.

    Are there any patterns as to which posts are missing authors? Are they older posts or newer posts? Have you updated them recently? How many total posts have been affected?

    I'm sorry to say, because I had deployed to a live network, I was not able to properly investigate before downgrading to 2.6.4.

    From what I saw on the first edit.php posts listing page for my custom post type 'articles', showing the most-recent 20 posts, two were missing co-authors. When I viewed these two posts on the live site, output via the CAP template tags also went missing there.

    • I run a multi-site 3.4.2, with no modifications to WP code.
    • Mentionable Plugins:
      • Custom Post Type UI. All custom post types support "Author".
      • WordPress Gzip Compression.
      • I run a simple filter on the 'coauthors_posts_link' template tag to prepend $args['text'] with an author mug and wrap the names and affiliations in google rich text snippet markup (using <span>'s). I didn't consider that 'coauthors_posts_link' template tag may be used not only in the template but also in the WP admin. If it indeed is, I suppose I could have bungled it somehow.

    Thank you for your help. If CAP 3.0 worked for WordPress VIP, it should work for me. So please don't bother with my case any further. I will re-upgrade to 3.0 on my development server and figure it out.

  4. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Most co-authors are successfully echoed in the list of posts (edit.php), but for any post edited, no longer do I see any co-authors (nor author) module anywhere in the post edit page (post.php?action=edit). So I am not able to re-assign any author or co-authors for any posts.

    I suspect I know what this bug is because I ran into something similar. It should be fixed in 3.0.1 (just released). We changed how we determine whether you should have permission to edit a post. Super admins don't have any caps to check if they aren't a user on the blog, so I fixed it by adding a super admin check.

    From what I saw on the first edit.php posts listing page for my custom post type 'articles', showing the most-recent 20 posts, two were missing co-authors. When I viewed these two posts on the live site, output via the CAP template tags also went missing there.

    That's really odd. I haven't been able to reproduce this so any further details you can track down would be great.

  5. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    From what I saw on the first edit.php posts listing page for my custom post type 'articles', showing the most-recent 20 posts, two were missing co-authors. When I viewed these two posts on the live site, output via the CAP template tags also went missing there.

    Based on some debugging I'm doing with a friend, I may have tracked this down. For the posts missing authors, did you edit the user_nicename value for the author by chance?

  6. osm2
    Member
    Posted 1 year ago #

    Thank you for your troubleshooting.

    I do frequently edit the value of user_nicename. I don't believe any were edited after the upgrade, however.

  7. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Ok. We tracked down down the bug to be a manifestation of how Co-Authors Plus looks up users and guest authors based on user_nicename.

    Before v3.0, Co-Authors Plus would look up a user based on their user_login value. If I had a user_login of 'apple', Co-Authors Plus would look for a term with slug 'apple' and vice versa.

    In v3.0, Co-Authors Plus looks up a user based on their user_nicename value. Typically this is very similar to user_login and should be the exact same as the term slug. Unless, of course, in situations like this where the plugin has allowed you to edit the user_nicename. In this particular case the term slug and user_nicename are no longer equivalent and the lookup fails. The term to post relationship is still there, so the byline essentially persists, but Co-Authors Plus doesn't know who to associate the term with.

    So, let's talk fixes. There are two things you can do:

    • Edit the user_nicename for any users missing their posts so that their user_nicename matches their user_login
    • Edit the slug associated with the user's term so that it matches their user_nicename

    On the bright side, for any author terms created after you've edited the user_nicename, the term slug will be correct and everything will work hunky dory. Any time you change the user_nicename though, the slug for the term will need to be updated as well.

  8. Jamil Jonna
    Member
    Posted 1 year ago #

    Hi,

    This is definitely not the problem I'm having. As you can see from an export of my users, the nicenames and usernames for nearly all of the authors match.

    http://i.imgur.com/6kNUV.png

    Further, I tried synchronizing the "nickname" (not "nicename" since those were all the same) to the username for several authors to see if they would show up on their respective posts. They did not. Here is one example:

    http://monthlyreview.org/press/books/pb1277/

    The second author should be "Marta Harnecker" but it does not show up, even after editing the author.

    The only problem that I see is with the "MR webmaster"—the account I use to login and edit pages. Now, this user login and nicename do not match. But because there is a space in the login (username) and because I cannot change the username, the two cannot be matched since the nicename cannot have spaces. If this is the reason why the coauthors are messed up on all of my posts, I'm going to need a better fix than what you suggest.

    BTW, here are my answers to your questions in the other post on this issue (http://wordpress.org/support/topic/all-authors-suddenly-vanished-from-posts?replies=7).

    For a post that is missing its authors, are you able to reassign authors?

    Yes, but see below on the number of posts this affected.

    Are there any patterns as to which posts are missing authors? Are they older posts or newer posts? Have you updated them recently?

    Absolutely none that I could find. As you can see by this screenshot, where authors are missing it is totally random:
    http://i.imgur.com/Yzaxk.png
    I have not updated any of these posts recently.

    How many total posts have been affected?

    I would estimate about 250. They are all of the same custom post type. There is an unusual amount of "ok posts" when I sort by date, but it still appears to be totally random.

  9. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    The second author should be "Marta Harnecker" but it does not show up, even after editing the author.

    Can you share all of Martha's values in the database now?

    Also, on this post http://monthlyreview.org/press/books/pb1277/ , have you hit "Update" since the author started missing? If you did, the byline is lost.

    But because there is a space in the login (username) and because I cannot change the username, the two cannot be matched since the nicename cannot have spaces.

    You are correct. The user_nicename is the sanitize_title() version of user_login. This means user_nicename is restricted to alphanumeric plus dashes.

    As you can see by this screenshot, where authors are missing it is totally random

    Do you happen to know the authors that should appear for any of those posts? Can you look in the database and see if there are corresponding terms associated with the post? You'd look in wp_term_relationships or similar.

  10. Jamil Jonna
    Member
    Posted 1 year ago #

    For Marta Harnecker, here are the values:

    author ID: 186
    login: martaharnecker
    nicename: martaharnecker
    term ID: 390

    The post ID that this coauthor should be linked with is 393. When I search for this post ID in terms_relationships-->object_id, I get the following term_taxonomy_id's. I've listed their relationships in parentheses:

    3 (post type), 11 (category), 37 (category), 388 (tag-chavez), 389 (author-chavez), 390 (tag-harnecker), 391 (author-harnecker)

    The only difference with the repeated authors is that one is an author and the other is a tag. So, term 390 has the values:

    name: Marta Harnecker
    slug: martaharnecker

    And term 391 has the values:

    name: martaharnecker
    slug: martaharnecker-2

    This is because for all posts we made sure to add the author names as tags as well as coauthors, in case something like this happened. Regardless, this coauthor should be linked with this post but it is not.

    One other thing I should mention, though it should not matter, is that I do not use the default prefix.

  11. Jamil Jonna
    Member
    Posted 1 year ago #

    Is it ok to downgrade to the 2x branch? It does not seem like you'll be getting this fixed any time soon.

    Thanks.

  12. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Is it ok to downgrade to the 2x branch?

    Not sure, haven't tested.

    And term 391 has the values:

    name: martaharnecker
    slug: martaharnecker-2

    If you update this term to have a slug of 'cap-martaharnecker', the problem should magically fix itself. This problem existed in pre-3.0 too, but in 3.0 we started prefixing slugs with 'cap-' if they don't already exist.

  13. Jamil Jonna
    Member
    Posted 1 year ago #

    Thank you: that did work.

    But I feel like I should remind you that everything worked just fine before the update. Perhaps you should write a script to help folks that are having problems like this as I'm sure there are more? Or maybe you can help me "magically" change the 400 or so terms that need to be changed?

  14. Jamil Jonna
    Member
    Posted 1 year ago #

    I'm not sure you have any idea what an amazing clusterfuck this has created. In my DB, there are now hundreds of duplicate "cap-%" (%=wildcard) terms and because of their existence, I cannot change all of the incorrect "%-2" terms to "cap-%" since they MySQL correctly identifies them as duplicates. Did you really not write a script to transform these terms when you made this change? This seems like pretty bad programming.

    In any case, what would you suggest I do? Delete all the current "cap-%" terms and so that I can change the current "%-2" terms? What a mess.

    Further, this now appears to have created a disconnection with the authors database, such that the author posts don't register correctly. This is really quite unfortunate.

  15. Jamil Jonna
    Member
    Posted 1 year ago #

    So, I went through the tedious process of fixing all of these problems and now I have noticed that coauthors seems to disregard the sorting behavior of coauthors. I don't remember this being the case before. Is there anyway to fix this? It is a major problem for sites that have books, as ours does. Feel free to move this to a new topic.

    Edit: Actually, I know this is not how it used to work. Because this post is sorting correctly: http://monthlyreview.org/2012/09/01/medicine-and-empire. However, this is version 3.0—I have not updated yet. So, either the "magic" fix I just made screwed something up, or the behavior is different. I would love to know the answer here.

    Moving the part of the discussion about sorting here: http://wordpress.org/support/topic/coauthor-sort-order-lost-in-31-or-32

  16. Jamil Jonna
    Member
    Posted 1 year ago #

    If anyone needs help fixing their terms, the method I used was to find all of the duplicate term entries created by CAP, delete them, and then change the slug to "cap-%" (%=wildcard). You can do this pretty easily by exporting your terms table and creating a MATCH column in Excel. The you have to create a bunch of MySQL commands to delete the extra terms, and the update the other terms.

  17. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    But I feel like I should remind you that everything worked just fine before the update.

    I suspect it did because Co-Authors Plus used to do the lookup against the name column, in which case the collisions with the tag terms didn't matter.

    Perhaps you should write a script to help folks that are having problems like this as I'm sure there are more?

    Yours is a pretty unique case. Without the tag collision scenario, the plugin handles backwards compatibility with terms without the prefix.

    There was, in fact, a script packaged with the plugin that we used on WordPress.com VIP to migrate the author terms. If you have wp-cli configured, you can use:

    wp co-authors-plus migrate-author-terms

  18. Glark
    Member
    Posted 1 year ago #

    Hi Daniel,

    I followed you to this thread from "Duplicates on Authors page" which is the issue I'm having too.

    Up above you suggested two solutions:

    1. Edit the user_nicename for any users missing their posts so that their user_nicename matches their user_login
    2. Edit the slug associated with the user's term so that it matches their user_nicename

    I can get #1 to work but not #2 which is what's i'd prefer in order to keep the author page urls 'nice'.

    I'm using the Edit Author Slug plug in and with an author with (for example):
    username: jsmith
    first name: John
    Last Name: Smith
    nickname: John Smith
    Display: John Smith
    and the author slug edited to: john-smith

    Shouldn't it work?

    Thanks!

  19. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    @glark you'll also need to dive into your database and edit the slug associated with the author's term. There's a custom taxonomy behind the scenes handling the relationship between posts and bylines.

  20. Glark
    Member
    Posted 1 year ago #

    Ok, thanks, I tried to follow the above conversation but I'm unclear what I need to change to what.

  21. Glark
    Member
    Posted 1 year ago #

    Or alternatively, can I nuke CAP's settings/DB and start over? I have fewer than 10 authors right now but 100s of stories.

  22. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    If all of the authors are appropriately associated with posts when the plugin is deactivated, you should be fine deleting all 'author' terms and term relationships. New terms will be regenerated the first time you assign the author to the post.

  23. Glark
    Member
    Posted 1 year ago #

    So here's my wp_term_taxonomy. I have 10 authors on the site and 20 entries here. The blurred out bits on the last 10 entries are author info.

    https://www.evernote.com/shard/s2/sh/ca8fd800-d208-49de-9b17-465187ee0e0d/7d74381775e1fb9a303b3cf552f7b293

    Can I ask what I'm to nuke here? I'd guess either the first 10 or the second ten but I'm not sure.

    Then do I find the same term_taxonomy_id in wp_term_taxonomy and nuke those entries?

    Please pretend I'm 5 years old when you explain it. :)

  24. Glark
    Member
    Posted 1 year ago #

    Followup! I re-entered the authors in each post and and that seemed to have corrected the issue. I have correct author counts, no weird duplicates in the author archive and I'm using the custom author slugs too. Thanks for a great plugin Daniel.

  25. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Glad to hear :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic