Changeset 5629
- Timestamp:
- 07/07/2017 08:12:06 PM (7 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/bbpress/user-profile.php
r5617 r5629 116 116 117 117 <p class="bbp-user-topic-count"><?php 118 $review_count = wporg_support_get_user_review_count();119 120 118 /* translators: %s: number of user's topics */ 121 printf( esc_html__( 'Topics Started: %s', 'wporg-forums' ), number_format_i18n( bbp_get_user_topic_count_raw() - $review_count) );119 printf( esc_html__( 'Topics Started: %s', 'wporg-forums' ), number_format_i18n( wporg_support_get_user_topics_count() ) ); 122 120 ?></p> 123 121 … … 129 127 <p class="bbp-user-review-count"><?php 130 128 /* translators: %s: number of user's reviews */ 131 printf( esc_html__( 'Reviews Written: %s', 'wporg-forums' ), number_format_i18n( $review_count) );129 printf( esc_html__( 'Reviews Written: %s', 'wporg-forums' ), number_format_i18n( wporg_support_get_user_reviews_count() ) ); 132 130 ?></p> 133 131 </div> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
r5626 r5629 215 215 216 216 /** 217 * Return the raw database count of topics by a user, excluding reviews. 218 * 219 * @global wpdb $wpdb WordPress database abstraction object. 220 * 221 * @param int $user_id User ID to get count for. 222 * @return int Raw DB count of topics. 223 */ 224 function wporg_support_get_user_topics_count( $user_id = 0 ) { 225 global $wpdb; 226 227 $user_id = bbp_get_user_id( $user_id ); 228 if ( empty( $user_id ) ) { 229 return 0; 230 } 231 232 if ( ! class_exists( 'WordPressdotorg\Forums\Plugin' ) ) { 233 return 0; 234 } 235 236 $count = (int) $wpdb->get_var( $wpdb->prepare( 237 "SELECT COUNT(*) 238 FROM {$wpdb->posts} 239 WHERE post_type = 'topic' 240 AND post_status IN ( 'publish', 'closed' ) 241 AND post_parent <> %d 242 AND post_author = %d", 243 WordPressdotorg\Forums\Plugin::REVIEWS_FORUM_ID, 244 $user_id 245 ) ); 246 247 return $count; 248 } 249 250 /** 217 251 * Return the raw database count of reviews by a user. 218 252 * … … 222 256 * @return int Raw DB count of reviews. 223 257 */ 224 function wporg_support_get_user_review _count( $user_id = 0 ) {258 function wporg_support_get_user_reviews_count( $user_id = 0 ) { 225 259 global $wpdb; 226 260
Note: See TracChangeset
for help on using the changeset viewer.