Ticket #1094: meta-1094.patch
File meta-1094.patch, 3.2 KB (added by , 10 years ago) |
---|
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php
57 57 58 58 <?php endif; // have_comments() ?> 59 59 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() ) : ?> 61 61 62 62 <p id="add-user-note" style="display:none;"><a href=""><?php _e( 'Have a note to contribute?', 'wporg' ); ?></a></p> 63 63 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php
1110 1110 } 1111 1111 1112 1112 /** 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 things1116 * that can have user contributed notes.1117 *1118 * A custom check can be performed by hooking the filter1119 * 'wporg_devhub-can_user_post_note' and returning a1120 * value other than null.1121 *1122 * By default, the ability to post notes is restricted to members of the1123 * 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 /**1146 1113 * Gets the summary. 1147 1114 * 1148 1115 * 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
28 28 // Restricts commenting to logged in users. 29 29 add_filter( 'comments_open', array( __CLASS__, 'prevent_invalid_comment_submissions' ), 10, 2 ); 30 30 31 // Sets whether submitting notes is open for the user32 add_filter( 'comments_open', '\DevHub\\can_user_post_note', 10, 2 );33 34 31 // Enqueue scripts and styles 35 32 add_action( 'wp_enqueue_scripts', array( __CLASS__, 'scripts_and_styles' ), 11 ); 36 33