WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#33481 closed defect (bug) (fixed)

Documented $public_only parameter not passed to the get_usernumposts filter

Reported by: tmatsuur Owned by: swissspidy
Milestone: 4.3.1 Priority: normal
Severity: normal Version: 4.3
Component: Users Keywords: has-patch fixed-major
Focuses: docs Cc:
PR Number:

Description

Not additional $public_only parameter to the get_usernumposts filter.

user.php

280line:

	 * @since 4.3.0 Added `$public_only` argument.

285line:

	 * @param bool         $public_only Whether to limit counted posts to public posts.

287line:

	return apply_filters( 'get_usernumposts', $count, $userid, $post_type );

Correctly,
287line:

	return apply_filters( 'get_usernumposts', $count, $userid, $post_type, $public_only );

280 line of since also wonder to change?

Attachments (1)

33481.patch (964 bytes) - added by swissspidy 4 years ago.
Correctly add the $public_only param. Also fixes the $post_type variable name in the docblock.

Download all attachments as: .zip

Change History (19)

#1 @swissspidy
4 years ago

  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to 4.3.1
  • Owner set to swissspidy
  • Status changed from new to accepted

Thanks for your report! Looks like that was introduced in [32523] (see #32243).

Will create a patch right away.

@swissspidy
4 years ago

Correctly add the $public_only param. Also fixes the $post_type variable name in the docblock.

#2 @swissspidy
4 years ago

  • Summary changed from Not additional $public_only parameter to the get_usernumposts filter(count_user_posts function) to Documented $public_only parameter not passed to the get_usernumposts filter

#3 @swissspidy
4 years ago

  • Component changed from General to Users
  • Focuses docs added
  • Keywords has-patch added; needs-patch removed

#4 @tmatsuur
4 years ago

Thank you for quick response.

This ticket was mentioned in Slack in #core by swissspidy. View the logs.


4 years ago

#6 @obenland
4 years ago

@boonebgorges could you review the patch? Thanks!

#7 follow-up: @boonebgorges
4 years ago

  • Milestone changed from 4.3.1 to 4.4

Thanks for the report and for the patch! This was my oversight.

As it's not a functional regression, I don't see that this needs to be fixed in 4.3.1. DrewAPicture, do we have a standard for "hotfixing" documentation errors on developer.wordpress.org?

This ticket was mentioned in Slack in #core by drew. View the logs.


4 years ago

#9 in reply to: ↑ 7 @DrewAPicture
4 years ago

Replying to boonebgorges:

Thanks for the report and for the patch! This was my oversight.

As it's not a functional regression, I don't see that this needs to be fixed in 4.3.1. DrewAPicture, do we have a standard for "hotfixing" documentation errors on developer.wordpress.org?

@boonebgorges: Not sure I'm following where the documentation error is? Is it that the new parameter was "added" except it wasn't actually added? We can make temporary edits to summaries and descriptions, but adjusting the parameters/changelog isn't really in the cards.

#10 @DrewAPicture
4 years ago

After chatting with Boone briefly in Slack (linked above), my best suggestion would be to simply add the parameter and ship the change with 4.3.1.

#11 @boonebgorges
4 years ago

  • Milestone changed from 4.4 to 4.3.1

#12 @boonebgorges
4 years ago

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

In 33710:

Pass the $public_only value to 'get_usernumposts' filter.

[32523] introduced the $public_only parameter to count_user_posts(). That
changeset was supposed to pass $public_only to the 'get_usernumposts' filter
at the end of the function, but only the documentation was modified, not the
filter itself.

This changeset also fixes an incorrect variable name in the docblock for
the same filter.

Props swisspidy, tmatsuur.
Fixes #33481 for trunk.

#13 @DrewAPicture
4 years ago

  • Keywords fixed-major added; good-first-bug removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

#14 @dimadin
4 years ago

Looking at this change, I see that documentation for $post_type is not in sync in this and related functions. Should we say 'Single post type or an array of post types...' for better clarity?

#15 @tyxla
4 years ago

I think this should be addressed in a separate ticket, see #33520.

#16 @DrewAPicture
4 years ago

In 33716:

Docs: Better clarify that the $post_type parameter for the get_usernumposts filter and count_user_posts() can accept either a single post type or array of post types.

Props tyxla
See #33481. Fixes #33520.

This ticket was mentioned in Slack in #core by sam. View the logs.


4 years ago

#18 @boonebgorges
4 years ago

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

In 33953:

Pass the $public_only value to 'get_usernumposts' filter.

[32523] introduced the $public_only parameter to count_user_posts(). That
changeset was supposed to pass $public_only to the 'get_usernumposts' filter
at the end of the function, but only the documentation was modified, not the
filter itself.

This changeset also fixes an incorrect variable name in the docblock for
the same filter, and includes clarification on the accepted values for
the $post_type parameter.

Merges [33710] and [33716] to the 4.3 branch.

Props swisspidy, tmatsuur, tyxla, DrewAPicture.
Fixes #33481 for 4.3.1.

Note: See TracTickets for help on using tickets.