Automattic / Co-Authors-Plus

Multiple bylines and Guest Authors for WordPress
https://wordpress.org/plugins/co-authors-plus/
GNU General Public License v2.0
290 stars 205 forks source link

Slug management for guest authors #29

Open danielbachhuber opened 12 years ago

danielbachhuber commented 12 years ago

The 'slug' is how the relationship between the guest author and the 'author' taxonomy term is maintained. The 'author' taxonomy term is what's saved in relationship to the post. Thus, changing these together allows us to associate a post with a guest author.

For instance, I may have a post saved with 'daniel' as one of my 'author' taxonomy term values, or co-authors. When I use get_coauthor_by(), the code looks for a guest author with 'daniel' as the slug (actually stored in the post_name) and returns that data instead.

As of Friday the 4th of May at 5 pm, the slug is established from the user_login value when the guest author is created from an existing user, and from the 'Display Name' field the first time a new guest author is saved. We need a way of editing the slug for any guest author, but this will be more complex to do because we have to accommodate these use cases:

Slug management will have at least these requirements:

netaustin commented 12 years ago

I'm adding a feature to CoAuthors_Guest_Authors, such that user accounts can be associated with guest authors. This will also necessitate an addition to coauthors_plus to auto-set the first author to a guest author if one is specified for the currently logged in user.

Finally, this will allow for the tag name and the guest author slug to be different than user_login. So I believe that the points that my pull request will not address are:

I would propose that we create a separate issue to handle slug renaming.

danielbachhuber commented 11 years ago

Punting on slug management for v3.0. For now, the slug will be the sanitize_title() version of the display name or, in the case of creating a guest author profile from a user, maybe the user_login

flagster76 commented 10 years ago

The ability to change the slug would actually be a really useful feature for our site. As it stands, there's no clean way of fixing slugs through the UI short of creating a new guest author with the correct slug, reassigning authorship for posts to the new guest author, and then deleting the old guest author with the undesirable slug. It's easy enough to do for an author that only has a couple posts under one slug or the other, of course, but it isn't a practical solution for an author that has hundreds of posts (especially for VIP-managed sites where even admins don't have SQL-level access and can at best only script the changes using WPCLI).

With more experience on the codebase I'd venture in and try my own hand at updating the plugin, but I figured I'd at least :+1: this thread in case someone else with copious amounts of free time gets to it first :o)

jhubsch commented 2 years ago

Hi, all - I came across this issue as well. As @flagster76 mentioned above, there are issues on VIP-managed sites, and they are still persistent.

To reiterate the bug:

If a WP user is deleted and then a Guest Author is created with a name that results in the Guest Author having the same slug as the deleted WP user, that Guest Author cannot be selected in the Guest Authors drop-down.

Steps to Reproduce:

  1. Sign in to WP Admin.
  2. Create a WP user:
  3. Delete that WP user.
  4. Create a Guest Author:
    • display name: Test User
  5. Go to the posts list.
  6. Quick-edit a post and try to set the author to Test User (which will have been given the username/slug of test-user) and find that you cannot find or select that author from the list.

Are we able to add an ability to edit or change a user slug? Or is there some other means of getting around this bug?