WordPress.org

Plugin Directory

Opened 2 years ago

Closed 2 years ago

#1433 closed enhancement (fixed)

Co-Authors Plus: Improve how post counts are managed for users

Reported by: danielbachhuber Owned by: danielbachhuber
Priority: normal Severity: normal
Plugin: not-listed Keywords: co-authors-plus
Cc: batmoo

Description

Currently, the activation hook for Co-Authors Plus doesn't do anything useful.

Ideally, when Co-Authors Plus is first used, it should create taxonomy terms for all of the users, properly set associations with existing posts, and update the post count for each author.

We'll need to do this in a way that works for sites with large number of posts and/or users.

Change History (6)

comment:1 danielbachhuber2 years ago

  • Summary changed from Co-Authors Plus: Better activation hook to Co-Authors Plus: Populate data on activation

comment:2 danielbachhuber2 years ago

  • Status changed from new to assigned
  • Summary changed from Co-Authors Plus: Populate data on activation to Co-Authors Plus: Improve how post counts are managed for users

There's a better approach for this: let's produce all of the data on the fly.

Basically, we need to do two things.

  • Anytime we're getting the post count for an author, we need to fall back on WP default if the author doesn't exist as a term.
  • When we're creating or updating a co-author term, we need to count both the number of term relationships they have as well as the number of post_author and then de-dupe.

comment:3 danielbachhuber2 years ago

In [479589]:

Co-Authors Plus: Only modify count_user_posts() when the author exists as a term object

See #1433

comment:4 danielbachhuber2 years ago

We may also need to unset the "posts" column in the Users WP List Table and do our own custom calculation...

comment:5 danielbachhuber2 years ago

In [479608]:

Co-Authors Plus: Provide our own custom post count as count_many_users_posts() in core Users WP_List_Table isn't filterable function anywhere but count_user_posts() is

See #1433

comment:6 danielbachhuber2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In [479620]:

Co-Authors Plus: Properly update the number of posts for each user by providing a callback for updating the post terms

Closes #1433

Note: See TracTickets for help on using tickets.