Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#15200 closed enhancement (wontfix)

Showing number of user posts for custom post types on users.php

Reported by: jaredwilli Owned by:
Milestone: Priority: normal
Severity: trivial Version: 3.0.1
Component: Users Keywords: custom post types
Focuses: Cc:


On a site I have where anyone can join and submit as a contributor new posts to custom post types, there are hundreds of users, and hundreds of submitted posts from them, but when viewing the users.php page in the dashboard it shows them all having 0 posts since that column only displays the number of 'post' posts they have.

With the rise of custom post types, it might be worth thinking about a way to change this, so that custom post types are also displayed, showing the number of posts a user has for them, and linking that number to the custom post type post manage page like the 'post' one does now.

I can't even find a way to hook into the table that displays the user info where the posts number/link is outputted, so that I can add a filter for displaying my own custom post type columns and post counts for each person.

This may not be a core issue as it isn't possible to know what the names people will have for CPTs. I saw in template.php in the set_current_screen() function that 'post' 'page' and the actions were hardcoded. May be a plugins job for this idk. Sorry if this ticket exists already too.

Change History (3)

comment:1 @nacin5 years ago

Didn't have a chance to respond to you on Twitter yet, but I don't see this as something we should account for on users.php. We very specifically are showing a count of posts.

Some post types might store information that isn't conducive to a count. For example, logging the actions of a user might have post_author set, but that doesn't mean it should count as a post. Same with maybe tweets by that user. It's ultimately just dependent on the desires of the administrator, which is why it should be left up to plugins to override this column if they so wish to do so. As I did say on Twitter, I'm not even sure where we'd be able to link a count if it includes more than one post type, as well. We don't even include pages -- if we had, then maybe an argument for other post types would make sense.

Re: naming of post types, we have get_post_types() and such... Re: set_current_screen(), that's unrelated and has to do with edit.php, edit-pages.php, post-new.php, etc.

comment:2 @jaredwilli5 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

I understand this not being a core issue, and more so now too. What I'm having trouble finding is a way to hook into whatever function is used to output the list of users, and the number of their posts. I don't see how it would be done, if this were to be done using a plugin. I've looked over several files besides just template.php and users.php, too and was unable to find anything.

Anyways, that's not a question that should be asked here. I'll try wp-hackers or the forum or something. Thanks.

comment:3 @nacin5 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.