Changeset 3505 for branches/plugin/bbp-admin/bbp-functions.php
- Timestamp:
- 09/10/2011 10:27:19 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-functions.php
r3415 r3505 196 196 $tpt = bbp_get_topic_post_type(); 197 197 $rpt = bbp_get_reply_post_type(); 198 $pps = 'publish';199 $cps = $bbp->closed_status_id;198 $pps = bbp_get_public_status_id(); 199 $cps = bbp_get_closed_status_id(); 200 200 201 201 $sql = "INSERT INTO `{$wpdb->postmeta}` (`post_id`, `meta_key`, `meta_value`) ( … … 240 240 $tpt = bbp_get_topic_post_type(); 241 241 $rpt = bbp_get_reply_post_type(); 242 $pps = 'publish';243 $cps = $bbp->closed_status_id;242 $pps = bbp_get_public_status_id(); 243 $cps = bbp_get_closed_status_id(); 244 244 245 245 $sql = "INSERT INTO `{$wpdb->postmeta}` (`post_id`, `meta_key`, `meta_value`) ( … … 280 280 return array( 1, sprintf( $statement, $result ) ); 281 281 282 $sql = "INSERT INTO `{$wpdb->postmeta}` (`post_id`, `meta_key`, `meta_value`) (SELECT `post_parent`, '_bbp_reply_count_hidden', COUNT(`post_status`) as `meta_value` FROM `{$wpdb->posts}` WHERE `post_type` = '" . bbp_get_reply_post_type() . "' AND `post_status` IN ( '" . join( "','", array( 'trash', $bbp->spam_status_id) ) . "') GROUP BY `post_parent`);";282 $sql = "INSERT INTO `{$wpdb->postmeta}` (`post_id`, `meta_key`, `meta_value`) (SELECT `post_parent`, '_bbp_reply_count_hidden', COUNT(`post_status`) as `meta_value` FROM `{$wpdb->posts}` WHERE `post_type` = '" . bbp_get_reply_post_type() . "' AND `post_status` IN ( '" . join( "','", array( 'trash', bbp_get_spam_status_id() ) ) . "') GROUP BY `post_parent`);"; 283 283 if ( is_wp_error( $wpdb->query( $sql ) ) ) 284 284 return array( 2, sprintf( $statement, $result ) ); … … 367 367 */ 368 368 function bbp_recount_user_topics_replied() { 369 global $wpdb ;369 global $wpdb, $bbp; 370 370 371 371 $statement = __( 'Counting the number of topics to which each user has replied… %s', 'bbpress' ); 372 372 $result = __( 'Failed!', 'bbpress' ); 373 373 374 $sql_select = "SELECT `post_author`, COUNT(DISTINCT `ID`) as `_count` FROM `{$wpdb->posts}` WHERE `post_type` = '" . bbp_get_reply_post_type() . "' AND `post_status` = ' publish' GROUP BY `post_author`;";374 $sql_select = "SELECT `post_author`, COUNT(DISTINCT `ID`) as `_count` FROM `{$wpdb->posts}` WHERE `post_type` = '" . bbp_get_reply_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "' GROUP BY `post_author`;"; 375 375 $insert_rows = $wpdb->get_results( $sql_select ); 376 376 … … 706 706 */ 707 707 function bbp_recount_clean_favorites() { 708 global $wpdb ;708 global $wpdb, $bbp; 709 709 710 710 $statement = __( 'Removing trashed topics from user favorites… %s', 'bbpress' ); … … 715 715 return array( 1, sprintf( $statement, $result ) ); 716 716 717 $topics = $wpdb->get_col( "SELECT `ID` FROM `$wpdb->posts` WHERE `post_type` = '" . bbp_get_topic_post_type() . "' AND `post_status` = ' publish';" );717 $topics = $wpdb->get_col( "SELECT `ID` FROM `$wpdb->posts` WHERE `post_type` = '" . bbp_get_topic_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "';" ); 718 718 719 719 if ( is_wp_error( $topics ) ) … … 765 765 */ 766 766 function bbp_recount_clean_subscriptions() { 767 global $wpdb ;767 global $wpdb, $bbp; 768 768 769 769 $statement = __( 'Removing trashed topics from user subscriptions… %s', 'bbpress' ); … … 774 774 return array( 1, sprintf( $statement, $result ) ); 775 775 776 $topics = $wpdb->get_col( "SELECT `ID` FROM `$wpdb->posts` WHERE `post_type` = '" . bbp_get_topic_post_type() . "' AND `post_status` = ' publish';" );776 $topics = $wpdb->get_col( "SELECT `ID` FROM `$wpdb->posts` WHERE `post_type` = '" . bbp_get_topic_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "';" ); 777 777 if ( is_wp_error( $topics ) ) 778 778 return array( 2, sprintf( $statement, $result ) ); … … 822 822 */ 823 823 function bbp_recount_rewalk() { 824 global $wpdb ;824 global $wpdb, $bbp; 825 825 826 826 $statement = __( 'Recomputing latest post in every topic and forum… %s', 'bbpress' ); … … 835 835 ( SELECT `topic`.`ID`, '_bbp_last_reply_id', MAX( `reply`.`ID` ) 836 836 FROM `$wpdb->posts` AS `topic` INNER JOIN `$wpdb->posts` AS `reply` ON `topic`.`ID` = `reply`.`post_parent` 837 WHERE `reply`.`post_status` IN ( ' publish' ) AND `topic`.`post_type` = 'topic' AND `reply`.`post_type` = 'reply'837 WHERE `reply`.`post_status` IN ( '" . bbp_get_public_status_id() . "' ) AND `topic`.`post_type` = 'topic' AND `reply`.`post_type` = 'reply' 838 838 GROUP BY `topic`.`ID` );" ) ) ) 839 839 return array( 2, sprintf( $statement, $result ) ); … … 851 851 ( SELECT `forum`.`ID`, '_bbp_last_topic_id', `topic`.`ID` 852 852 FROM `$wpdb->posts` AS `forum` INNER JOIN `$wpdb->posts` AS `topic` ON `forum`.`ID` = `topic`.`post_parent` 853 WHERE `topic`.`post_status` IN ( ' publish' ) AND `forum`.`post_type` = 'forum' AND `topic`.`post_type` = 'topic'853 WHERE `topic`.`post_status` IN ( '" . bbp_get_public_status_id() . "' ) AND `forum`.`post_type` = 'forum' AND `topic`.`post_type` = 'topic' 854 854 GROUP BY `forum`.`ID` );" ) ) ) 855 855 return array( 4, sprintf( $statement, $result ) ); … … 867 867 ( SELECT `topic`.`ID`, '_bbp_last_active_id', MAX( `reply`.`ID` ) 868 868 FROM `$wpdb->posts` AS `topic` INNER JOIN `$wpdb->posts` AS `reply` ON `topic`.`ID` = `reply`.`post_parent` 869 WHERE `reply`.`post_status` IN ( ' publish' ) AND `topic`.`post_type` = 'topic' AND `reply`.`post_type` = 'reply'869 WHERE `reply`.`post_status` IN ( '" . bbp_get_public_status_id() . "' ) AND `topic`.`post_type` = 'topic' AND `reply`.`post_type` = 'reply' 870 870 GROUP BY `topic`.`ID` );" ) ) ) 871 871 return array( 6, sprintf( $statement, $result ) ); … … 883 883 ( SELECT `topic`.`ID`, '_bbp_last_active_time', MAX( `reply`.`post_date` ) 884 884 FROM `$wpdb->posts` AS `topic` INNER JOIN `$wpdb->posts` AS `reply` ON `topic`.`ID` = `reply`.`post_parent` 885 WHERE `reply`.`post_status` IN ( ' publish' ) AND `topic`.`post_type` = 'topic' AND `reply`.`post_type` = 'reply'885 WHERE `reply`.`post_status` IN ( '" . bbp_get_public_status_id() . "' ) AND `topic`.`post_type` = 'topic' AND `reply`.`post_type` = 'reply' 886 886 GROUP BY `topic`.`ID` );" ) ) ) 887 887 return array( 8, sprintf( $statement, $result ) );
Note: See TracChangeset
for help on using the changeset viewer.