WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] Authors names don't show up in various places (Taxonomy) 3.0+ (8 posts)

  1. h0tw1r3
    Member
    Posted 1 year ago #

    There is a fundamental problem with relying on the slug to be a specific value. In various parts of the code, get_term_by is used to like:

    get_term_by( 'slug', $coauthor->user_nicename, $this->coauthor_taxonomy );

    user_nicename is not necessarily the same as a slug because slugs are required to be unique (even for different taxonomies). So, if you have a post tagged with the "Author Name", that post will have a term slug "author-name". Later on when the coauthor term is created it will have a -# appended to the slug (author-name-2).

    Problem described in core bug: http://core.trac.wordpress.org/ticket/5809

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

  2. h0tw1r3
    Member
    Posted 1 year ago #

    I see in the changelog for 3.0:

    * New author terms are now prefixed with 'cap-' to avoid collisions with global scope

    Perhaps an upgrade_30 function is in order?

  3. h0tw1r3
    Member
    Posted 1 year ago #

    Fix that works for me:
    https://gist.github.com/4227978

  4. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Hmm, upgrade.php should be gone from your plugin dir :)

    There's a wp-cli command you can use to migrate your author terms to their new prefixed versions:

    wp co-authors-plus migrate-author-terms

    I didn't do the upgrade on the fly like previous versions because it's costly with lots of terms and the plugin offers backwards compat to terms without the prefix.

  5. h0tw1r3
    Member
    Posted 1 year ago #

    1. For users without command-line access, how do they upgrade?

    2. Installing wp-cli is a complicated process for most wordpress users.

    3. Even after installing wp-cli, and restoring my database from a backup, terms are migrated -- the problem still exists.

    In get_coauthor_by, "slug" is used to lookup the author in the code and it expects that the 'author' term slug will always be the same as the 'user' slug.

    This is not always the case when the user has previously upgraded from 1.x - 2.x, because meta to term upgrade already occurred *without the cap- prefix*. So, because WordPress does not allow duplicate slugs in the _term table - even of different types - any duplicates would have be suffixed by a dash number (i.e. -2).

    Therefor the get_coauthor_by function never finds the correct user (or guest author).

  6. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    It shouldn't be a problem for most users. For users that have the problem, you can either:

    - rename the slug to drop the number prefix and prepend 'cap-'
    - delete the conflicting tag term, and then drop the number suffix from the author term

  7. h0tw1r3
    Member
    Posted 1 year ago #

    Since you're not responding to my points, I'll just say that you are very out of touch with the "average" WordPress user. Most are not programmers! I wish there was a hard statistic to back it up, but alas I can only go by experience. WordPress is chosen because it's well known, and easy to install.

    Anyway no point in arguing. It works for me now, I only came to help other users of your (quite good) plugin.

    "Not a problem for me, so it's not a problem" -programmer mantra

  8. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Sorry, I didn't mean to be flippant. I was in transit and should've waited to respond fully.

    To clarify what I meant previously, this is only a problem for users who have created tags with the same slug as a user's user_login. Pre-3.0, this meant that either the tag or the author term was appended with '-2' or similar. This wasn't a problem pre-3.0 because Co-Authors Plus did the lookup based on term name — now it is a problem because we've switched to term slug.

    Based on the number of reports I've gotten thus far, I don't believe this is widespread-enough of a problem to devote development hours to it. In fact, the most significant upgrade issue seemed to be users who modified their user_nicename value — something I didn't even consider to be a potential problem.

    To use Co-Authors Plus, a user will already have to be reasonably proficient because they have to edit their theme templates. I can't proactively account for every possible conflict. For this particular problem, I think it's reasonable to offer these forum threads as documentation of the issue and steps that need to be taken in order to fix it.

    I only came to help other users of your (quite good) plugin.

    I'm very happy to have you around, and I again apologize if I came off harsh. Offering free support for a free plugin is a bit grueling at times. I appreciate any help I can get.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic