Making WordPress.org

Ticket #1094: meta-1094.patch

File meta-1094.patch, 3.2 KB (added by SergeyBiryukov, 10 years ago)
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php

     
    5757
    5858        <?php endif; // have_comments() ?>
    5959
    60         <?php if ( \DevHub\is_parsed_post_type() && DevHub\can_user_post_note( false, get_the_ID() ) ) : ?>
     60        <?php if ( \DevHub\is_parsed_post_type() ) : ?>
    6161
    6262                <p id="add-user-note" style="display:none;"><a href=""><?php _e( 'Have a note to contribute?', 'wporg' ); ?></a></p>
    6363
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

     
    11101110        }
    11111111
    11121112        /**
    1113          * Indicates if the current user can post a user contibuted note.
    1114          *
    1115          * This only affects parsed post types as they are the only things
    1116          * that can have user contributed notes.
    1117          *
    1118          * A custom check can be performed by hooking the filter
    1119          * 'wporg_devhub-can_user_post_note' and returning a
    1120          * value other than null.
    1121          *
    1122          * By default, the ability to post notes is restricted to members of the
    1123          * blog.
    1124          *
    1125          * @param  bool    $open If the user can post comments in general. Disregarded.
    1126          * @param  WP_Post $post Post ID or post object.
    1127          *
    1128          * @return bool True if the user can post a note.
    1129          */
    1130         function can_user_post_note( $open, $post ) {
    1131                 // Only proceed if for a parsed post type.
    1132                 if ( ! is_parsed_post_type( get_post_type( $post ) ) ) {
    1133                         return $open;
    1134                 }
    1135 
    1136                 // Permit default logic to be overridden via filter that returns value other than null.
    1137                 if ( null !== ( $can = apply_filters( 'wporg_devhub-can_user_post_note', null, $post ) ) ) {
    1138                         return $can;
    1139                 }
    1140 
    1141                 // Default to limiting ability to post notes to members of the blog.
    1142                 return is_user_member_of_blog();
    1143         }
    1144 
    1145         /**
    11461113         * Gets the summary.
    11471114         *
    11481115         * The summary (aka short description) is stored in the 'post_excerpt' field.
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php

     
    2828                // Restricts commenting to logged in users.
    2929                add_filter( 'comments_open',                    array( __CLASS__, 'prevent_invalid_comment_submissions' ), 10, 2 );
    3030
    31                 // Sets whether submitting notes is open for the user
    32                 add_filter( 'comments_open',                    '\DevHub\\can_user_post_note', 10, 2 );
    33 
    3431                // Enqueue scripts and styles
    3532                add_action( 'wp_enqueue_scripts',               array( __CLASS__, 'scripts_and_styles' ), 11 );
    3633