Making WordPress.org

Changeset 1064


Ignore:
Timestamp:
12/23/2014 07:54:55 PM (11 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Minor changes to can_user_post_note():

  • Use existing post_type_supports_user_notes() rather than duplicating its check
  • Don't force post argument to be an int
  • Fix @param docblock missing argument name


File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

    r1063 r1064  
    883883     * Does the post type have source code?
    884884     *
    885      * @param  string  Optional. The post type name. If blank, assumes current post type.
    886      *
    887      * @return boolean
     885     * @param  null|string $post_type Optional. The post type name. If null, assumes current post type. Default null.
     886     *
     887     * @return bool
    888888     */
    889889    function post_type_has_source_code( $post_type = null ) {
     
    10031003     * blog.
    10041004     *
    1005      * @param  int  $post_id The post ID.
     1005     * @param  bool    $open If the user can post comments in general. Disregarded.
     1006     * @param  WP_Post $post Post ID or post object.
    10061007     *
    10071008     * @return bool True if the user can post a note.
    10081009     */
    1009     function can_user_post_note( $open, $post_id ) {
     1010    function can_user_post_note( $open, $post ) {
    10101011
    10111012        // Only proceed if the post type is one that has user contributed notes.
    1012         if ( 0 !== strpos( get_post_type( (int) $post_id ), 'wp-parser-' ) ) {
     1013        if ( ! post_type_supports_user_notes( get_post_type( $post ) ) ) {
    10131014            // Temporarily disable commenting that isn't for a note since various
    10141015            // changes need to take place to enable regular commenting.
     
    10171018
    10181019        // Permit default logic to be overridden via filter that returns value other than null.
    1019         if ( null !== ( $can = apply_filters( 'wporg_devhub-can_user_post_note', null, $post_id ) ) ) {
     1020        if ( null !== ( $can = apply_filters( 'wporg_devhub-can_user_post_note', null, $post ) ) ) {
    10201021            return $can;
    10211022        }
Note: See TracChangeset for help on using the changeset viewer.