Changeset 5629 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
- Timestamp:
- 07/07/2017 08:12:06 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.