Changeset 3505
- Timestamp:
- 09/10/2011 10:27:19 PM (13 years ago)
- Location:
- branches/plugin
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-forums.php
r3376 r3505 242 242 // Category? 243 243 if ( !empty( $_POST['bbp_forum_type'] ) && in_array( $_POST['bbp_forum_type'], array( 'forum', 'category' ) ) ) { 244 if ( 'category' == $_POST['bbp_forum_type'] && !bbp_is_forum_category( $forum_id ) ) 244 if ( 'category' == $_POST['bbp_forum_type'] && !bbp_is_forum_category( $forum_id ) ) { 245 245 bbp_categorize_forum( $forum_id ); 246 elseif ( 'forum' == $_POST['bbp_forum_type'] && bbp_is_forum_category( $forum_id ) )246 } elseif ( 'forum' == $_POST['bbp_forum_type'] && bbp_is_forum_category( $forum_id ) ) { 247 247 bbp_normalize_forum( $forum_id ); 248 } 248 249 } 249 250 250 251 // Visibility 251 if ( !empty( $_POST['bbp_forum_visibility'] ) && in_array( $_POST['bbp_forum_visibility'], array( 'publish', 'private', 'hidden') ) ) {252 if ( !empty( $_POST['bbp_forum_visibility'] ) && in_array( $_POST['bbp_forum_visibility'], array( bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id() ) ) ) { 252 253 253 254 // Get forums current visibility … … 261 262 262 263 // Hidden 263 case 'hidden':264 case bbp_get_hidden_status_id() : 264 265 bbp_hide_forum( $forum_id, $visibility ); 265 266 break; 266 267 267 268 // Private 268 case 'private':269 case bbp_get_private_status_id() : 269 270 bbp_privatize_forum( $forum_id, $visibility ); 270 271 break; 271 272 272 273 // Publish (default) 273 case 'publish':274 case bbp_get_public_status_id() : 274 275 default : 275 276 bbp_publicize_forum( $forum_id, $visibility ); … … 553 554 global $bbp; 554 555 556 // Bail if bbPress is not loaded 557 if ( 'bbPress' !== get_class( $bbp ) ) return; 558 555 559 $bbp->admin->forums = new BBP_Forums_Admin(); 556 560 } -
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 ) ); -
branches/plugin/bbp-admin/bbp-metaboxes.php
r3468 r3505 278 278 279 279 $forum['visibility'] = array( 280 'publish'=> __( 'Public', 'bbpress' ),281 'private'=> __( 'Private', 'bbpress' ),282 'hidden'=> __( 'Hidden', 'bbpress' )280 bbp_get_public_status_id() => __( 'Public', 'bbpress' ), 281 bbp_get_private_status_id() => __( 'Private', 'bbpress' ), 282 bbp_get_hidden_status_id() => __( 'Hidden', 'bbpress' ) 283 283 ); 284 284 $visibility_output = '<select name="bbp_forum_visibility" id="bbp_forum_visibility_select">' . "\n"; -
branches/plugin/bbp-admin/bbp-replies.php
r3445 r3505 666 666 */ 667 667 function replies_row_actions( $actions, $reply ) { 668 global $bbp;669 668 670 669 if ( bbp_get_reply_post_type() == $reply->post_type ) { … … 680 679 // Only show the actions if the user is capable of viewing them 681 680 if ( current_user_can( 'moderate', $reply->ID ) ) { 682 if ( in_array( $reply->post_status, array( 'publish', $bbp->spam_status_id) ) ) {681 if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_spam_status_id() ) ) ) { 683 682 $spam_uri = esc_url( wp_nonce_url( add_query_arg( array( 'reply_id' => $reply->ID, 'action' => 'bbp_toggle_reply_spam' ), remove_query_arg( array( 'bbp_reply_toggle_notice', 'reply_id', 'failed', 'super' ) ) ), 'spam-reply_' . $reply->ID ) ); 684 if ( bbp_is_reply_spam( $reply->ID ) ) 683 if ( bbp_is_reply_spam( $reply->ID ) ) { 685 684 $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark the reply as not spam', 'bbpress' ) . '">' . __( 'Not spam', 'bbpress' ) . '</a>'; 686 else685 } else { 687 686 $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark this reply as spam', 'bbpress' ) . '">' . __( 'Spam', 'bbpress' ) . '</a>'; 687 } 688 688 } 689 689 } … … 691 691 // Trash 692 692 if ( current_user_can( 'delete_reply', $reply->ID ) ) { 693 if ( $bbp->trash_status_id== $reply->post_status ) {693 if ( bbp_get_trash_status_id() == $reply->post_status ) { 694 694 $post_type_object = get_post_type_object( bbp_get_reply_post_type() ); 695 695 $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash', 'bbpress' ) ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $reply->ID ) ), 'untrash-' . $reply->post_type . '_' . $reply->ID ) ) . "'>" . __( 'Restore', 'bbpress' ) . "</a>"; … … 698 698 } 699 699 700 if ( $bbp->trash_status_id== $reply->post_status || !EMPTY_TRASH_DAYS ) {700 if ( bbp_get_trash_status_id() == $reply->post_status || !EMPTY_TRASH_DAYS ) { 701 701 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently', 'bbpress' ) ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $reply->ID, '', true ) ) . "'>" . __( 'Delete Permanently', 'bbpress' ) . "</a>"; 702 } elseif ( $bbp->spam_status_id== $reply->post_status ) {702 } elseif ( bbp_get_spam_status_id() == $reply->post_status ) { 703 703 unset( $actions['trash'] ); 704 704 } … … 873 873 global $bbp; 874 874 875 // Bail if bbPress is not loaded 876 if ( 'bbPress' !== get_class( $bbp ) ) return; 877 875 878 $bbp->admin->replies = new BBP_Replies_Admin(); 876 879 } -
branches/plugin/bbp-admin/bbp-topics.php
r3376 r3505 721 721 */ 722 722 function topics_row_actions( $actions, $topic ) { 723 global $bbp;724 723 725 724 if ( $topic->post_type == $this->post_type ) { … … 735 734 // Close 736 735 // Show the 'close' and 'open' link on published and closed posts only 737 if ( in_array( $topic->post_status, array( 'publish', $bbp->closed_status_id) ) ) {736 if ( in_array( $topic->post_status, array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ) ) { 738 737 $close_uri = esc_url( wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_close' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'close-topic_' . $topic->ID ) ); 739 738 if ( bbp_is_topic_open( $topic->ID ) ) … … 767 766 // Do not show trash links for spam topics, or spam links for trashed topics 768 767 if ( current_user_can( 'delete_topic', $topic->ID ) ) { 769 if ( $bbp->trash_status_id== $topic->post_status ) {768 if ( bbp_get_trash_status_id() == $topic->post_status ) { 770 769 $post_type_object = get_post_type_object( bbp_get_topic_post_type() ); 771 770 $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash', 'bbpress' ) ) . "' href='" . wp_nonce_url( add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ) ), admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $topic->ID ) ) ), 'untrash-' . $topic->post_type . '_' . $topic->ID ) . "'>" . __( 'Restore', 'bbpress' ) . "</a>"; … … 774 773 } 775 774 776 if ( $bbp->trash_status_id== $topic->post_status || !EMPTY_TRASH_DAYS ) {775 if ( bbp_get_trash_status_id() == $topic->post_status || !EMPTY_TRASH_DAYS ) { 777 776 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently', 'bbpress' ) ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $topic->ID, '', true ) ) . "'>" . __( 'Delete Permanently', 'bbpress' ) . "</a>"; 778 } elseif ( $bbp->spam_status_id== $topic->post_status ) {777 } elseif ( bbp_get_spam_status_id() == $topic->post_status ) { 779 778 unset( $actions['trash'] ); 780 779 } … … 949 948 global $bbp; 950 949 950 // Bail if bbPress is not loaded 951 if ( 'bbPress' !== get_class( $bbp ) ) return; 952 951 953 $bbp->admin->topics = new BBP_Topics_Admin(); 952 954 } -
branches/plugin/bbp-admin/bbp-users.php
r3376 r3505 111 111 global $bbp; 112 112 113 // Bail if bbPress is not loaded 114 if ( 'bbPress' !== get_class( $bbp ) ) return; 115 113 116 $bbp->admin->users = new BBP_Users_Admin(); 114 117 } -
branches/plugin/bbp-admin/importers/bbpress.php
r3376 r3505 880 880 881 881 $forum_map = array(); 882 $post_statuses = array( 'publish', $bbp->trash_status_id, $bbp->spam_status_id);882 $post_statuses = array( bbp_get_public_status_id(), bbp_get_trash_status_id(), bbp_get_spam_status_id() ); 883 883 884 884 foreach ( (array) $forums as $forum ) { … … 891 891 'post_title' => $forum->forum_name, 892 892 'post_excerpt' => '', 893 'post_status' => 'publish',893 'post_status' => bbp_get_public_status_id(), 894 894 'comment_status' => 'closed', 895 895 'ping_status' => 'closed', … … 944 944 945 945 // If the topic is public, check if it's open and set the status accordingly 946 $topic_status = $topic->topic_status == 0 ? ( $topic->topic_open == 0 ? $bbp->closed_status_id: $post_statuses[$topic->topic_status] ) : $post_statuses[$topic->topic_status];946 $topic_status = $topic->topic_status == 0 ? ( $topic->topic_open == 0 ? bbp_get_closed_status_id() : $post_statuses[$topic->topic_status] ) : $post_statuses[$topic->topic_status]; 947 947 948 948 $inserted_topic = wp_insert_post( array( … … 1038 1038 1039 1039 // Only add favorites and subscriptions if the topic is public 1040 if ( in_array( $topic_status, array( 'publish', $bbp->closed_status_id) ) ) {1040 if ( in_array( $topic_status, array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ) ) { 1041 1041 1042 1042 // Favorites -
branches/plugin/bbp-includes/bbp-common-functions.php
r3499 r3505 440 440 */ 441 441 function bbp_get_statistics( $args = '' ) { 442 global $bbp;443 442 444 443 $defaults = array ( … … 470 469 } 471 470 471 // Post statuses 472 $private = bbp_get_private_status_id(); 473 $spam = bbp_get_spam_status_id(); 474 $trash = bbp_get_trash_status_id(); 475 $closed = bbp_get_closed_status_id(); 476 472 477 // Topics 473 478 if ( !empty( $count_topics ) ) { … … 476 481 477 482 // Published (publish + closed) 478 $topic_count = $all_topics->publish + $all_topics->{$ bbp->closed_status_id};483 $topic_count = $all_topics->publish + $all_topics->{$closed}; 479 484 480 485 if ( current_user_can( 'read_private_topics' ) || current_user_can( 'edit_others_topics' ) || current_user_can( 'view_trash' ) ) { 481 486 482 487 // Private 483 $topics['private'] = ( !empty( $count_private_topics ) && current_user_can( 'read_private_topics' ) ) ? (int) $all_topics-> private: 0;488 $topics['private'] = ( !empty( $count_private_topics ) && current_user_can( 'read_private_topics' ) ) ? (int) $all_topics->{$private} : 0; 484 489 485 490 // Spam 486 $topics['spammed'] = ( !empty( $count_spammed_topics ) && current_user_can( 'edit_others_topics' ) ) ? (int) $all_topics->{$ bbp->spam_status_id}: 0;491 $topics['spammed'] = ( !empty( $count_spammed_topics ) && current_user_can( 'edit_others_topics' ) ) ? (int) $all_topics->{$spam} : 0; 487 492 488 493 // Trash 489 $topics['trashed'] = ( !empty( $count_trashed_topics ) && current_user_can( 'view_trash' ) ) ? (int) $all_topics->{$ bbp->trash_status_id}: 0;494 $topics['trashed'] = ( !empty( $count_trashed_topics ) && current_user_can( 'view_trash' ) ) ? (int) $all_topics->{$trash} : 0; 490 495 491 496 // Total hidden (private + spam + trash) … … 513 518 514 519 // Private 515 $replies['private'] = ( !empty( $count_private_replies ) && current_user_can( 'read_private_replies' ) ) ? (int) $all_replies-> private: 0;520 $replies['private'] = ( !empty( $count_private_replies ) && current_user_can( 'read_private_replies' ) ) ? (int) $all_replies->{$private} : 0; 516 521 517 522 // Spam 518 $replies['spammed'] = ( !empty( $count_spammed_replies ) && current_user_can( 'edit_others_replies' ) ) ? (int) $all_replies->{$ bbp->spam_status_id}: 0;523 $replies['spammed'] = ( !empty( $count_spammed_replies ) && current_user_can( 'edit_others_replies' ) ) ? (int) $all_replies->{$spam} : 0; 519 524 520 525 // Trash 521 $replies['trashed'] = ( !empty( $count_trashed_replies ) && current_user_can( 'view_trash' ) ) ? (int) $all_replies->{$ bbp->trash_status_id}: 0;526 $replies['trashed'] = ( !empty( $count_trashed_replies ) && current_user_can( 'view_trash' ) ) ? (int) $all_replies->{$trash} : 0; 522 527 523 528 // Total hidden (private + spam + trash) … … 714 719 */ 715 720 function bbp_filter_anonymous_post_data( $args = '', $is_edit = false ) { 716 global $bbp;717 721 718 722 // Assign variables … … 769 773 return true; 770 774 771 global $ bbp, $wpdb;775 global $wpdb; 772 776 773 777 extract( $post_data, EXTR_SKIP ); … … 792 796 // Simple duplicate check 793 797 // Expected slashed ($post_type, $post_parent, $post_author, $post_content, $anonymous_data) 794 $dupe = "SELECT ID FROM {$wpdb->posts} {$join} WHERE post_type = '{$post_type}' AND post_status != '{$bbp->trash_status_id}' AND post_author = {$post_author} AND post_content = '{$post_content}' {$where}"; 795 $dupe .= !empty( $post_parent ) ? " AND post_parent = '{$post_parent}'" : ''; 796 $dupe .= " LIMIT 1"; 797 $dupe = apply_filters( 'bbp_check_for_duplicate_query', $dupe, $post_data ); 798 $status = bbp_get_trash_status_id(); 799 $dupe = "SELECT ID FROM {$wpdb->posts} {$join} WHERE post_type = '{$post_type}' AND post_status != '{$status}' AND post_author = {$post_author} AND post_content = '{$post_content}' {$where}"; 800 $dupe .= !empty( $post_parent ) ? " AND post_parent = '{$post_parent}'" : ''; 801 $dupe .= " LIMIT 1"; 802 $dupe = apply_filters( 'bbp_check_for_duplicate_query', $dupe, $post_data ); 798 803 799 804 if ( $wpdb->get_var( $dupe ) ) { … … 855 860 * @since bbPress (r3446) 856 861 * 857 * @global bbPress $bbp858 862 * @param array $anonymous_data Anonymous user data 859 863 * @param int $author_id Topic or reply author ID … … 980 984 */ 981 985 function bbp_notify_subscribers( $reply_id = 0 ) { 982 global $ bbp, $wpdb;986 global $wpdb; 983 987 984 988 // Bail if subscriptions are turned off … … 1158 1162 // The ID of the cached query 1159 1163 $cache_id = 'bbp_parent_' . $parent_id . '_type_' . $post_type . '_child_last_id'; 1160 $post_status = array( 'publish');1164 $post_status = array( bbp_get_public_status_id() ); 1161 1165 1162 1166 // Add closed status if topic post type 1163 1167 if ( $post_type == bbp_get_topic_post_type() ) 1164 $post_status[] = $bbp->closed_status_id;1168 $post_status[] = bbp_get_closed_status_id(); 1165 1169 1166 1170 // Join post statuses together … … 1192 1196 */ 1193 1197 function bbp_get_public_child_count( $parent_id = 0, $post_type = 'post' ) { 1194 global $wpdb , $bbp;1198 global $wpdb; 1195 1199 1196 1200 // Bail if nothing passed … … 1200 1204 // The ID of the cached query 1201 1205 $cache_id = 'bbp_parent_' . $parent_id . '_type_' . $post_type . '_child_count'; 1202 $post_status = array( 'publish');1206 $post_status = array( bbp_get_public_status_id() ); 1203 1207 1204 1208 // Add closed status if topic post type 1205 1209 if ( $post_type == bbp_get_topic_post_type() ) 1206 $post_status[] = $bbp->closed_status_id;1210 $post_status[] = bbp_get_closed_status_id(); 1207 1211 1208 1212 // Join post statuses together … … 1234 1238 */ 1235 1239 function bbp_get_public_child_ids( $parent_id = 0, $post_type = 'post' ) { 1236 global $wpdb , $bbp;1240 global $wpdb; 1237 1241 1238 1242 // Bail if nothing passed … … 1242 1246 // The ID of the cached query 1243 1247 $cache_id = 'bbp_parent_public_' . $parent_id . '_type_' . $post_type . '_child_ids'; 1244 $post_status = array( 'publish');1248 $post_status = array( bbp_get_public_status_id() ); 1245 1249 1246 1250 // Add closed status if topic post type 1247 1251 if ( $post_type == bbp_get_topic_post_type() ) 1248 $post_status[] = $bbp->closed_status_id;1252 $post_status[] = bbp_get_closed_status_id(); 1249 1253 1250 1254 // Join post statuses together … … 1275 1279 */ 1276 1280 function bbp_get_all_child_ids( $parent_id = 0, $post_type = 'post' ) { 1277 global $wpdb , $bbp;1281 global $wpdb; 1278 1282 1279 1283 // Bail if nothing passed … … 1283 1287 // The ID of the cached query 1284 1288 $cache_id = 'bbp_parent_all_' . $parent_id . '_type_' . $post_type . '_child_ids'; 1285 $post_status = array( 'publish');1289 $post_status = array( bbp_get_public_status_id() ); 1286 1290 1287 1291 // Extra post statuses based on post type … … 1290 1294 // Forum 1291 1295 case bbp_get_forum_post_type() : 1292 $post_status[] = 'private';1293 $post_status[] = $bbp->hidden_status_id;1296 $post_status[] = bbp_get_private_status_id(); 1297 $post_status[] = bbp_get_hidden_status_id(); 1294 1298 break; 1295 1299 1296 1300 // Topic 1297 1301 case bbp_get_topic_post_type() : 1298 $post_status[] = $bbp->closed_status_id;1299 $post_status[] = $bbp->trash_status_id;1300 $post_status[] = $bbp->spam_status_id;1302 $post_status[] = bbp_get_closed_status_id(); 1303 $post_status[] = bbp_get_trash_status_id(); 1304 $post_status[] = bbp_get_spam_status_id(); 1301 1305 break; 1302 1306 1303 1307 // Reply 1304 1308 case bbp_get_reply_post_type() : 1305 $post_status[] = $bbp->trash_status_id;1306 $post_status[] = $bbp->spam_status_id;1309 $post_status[] = bbp_get_trash_status_id(); 1310 $post_status[] = bbp_get_spam_status_id(); 1307 1311 break; 1308 1312 } … … 1331 1335 * 1332 1336 * @global WP_Query $wp_query 1333 * @global bbPress $bbp1334 1337 * @param array $query_vars 1335 1338 * @return array 1336 1339 */ 1337 1340 function bbp_request_feed_trap( $query_vars ) { 1338 global $wp_query , $bbp;1341 global $wp_query; 1339 1342 1340 1343 // Looking at a feed … … 1349 1352 // Forum 1350 1353 case bbp_get_forum_post_type() : 1354 1355 // Declare local variable(s) 1356 $meta_query = array(); 1351 1357 1352 1358 // Single forum … … 1368 1374 'value' => $forum_id, 1369 1375 'compare' => '=' 1370 ) ); 1371 1372 // No restrictions on forum ID 1373 } else { 1374 $meta_query = array(); 1376 ) ); 1375 1377 } 1376 1378 … … 1383 1385 'post_type' => bbp_get_reply_post_type(), 1384 1386 'post_parent' => 'any', 1385 'post_status' => join( ',', array( 'publish', $bbp->closed_status_id) ),1387 'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ), 1386 1388 'posts_per_page' => get_option( '_bbp_replies_per_rss_page', 25 ), 1387 1389 'order' => 'DESC', … … 1400 1402 'post_type' => bbp_get_topic_post_type(), 1401 1403 'post_parent' => 'any', 1402 'post_status' => join( ',', array( 'publish', $bbp->closed_status_id) ),1404 'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ), 1403 1405 'posts_per_page' => get_option( '_bbp_topics_per_rss_page', 25 ), 1404 1406 'order' => 'DESC', … … 1417 1419 'post_type' => array( bbp_get_reply_post_type(), bbp_get_topic_post_type() ), 1418 1420 'post_parent' => 'any', 1419 'post_status' => join( ',', array( 'publish', $bbp->closed_status_id) ),1421 'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ), 1420 1422 'posts_per_page' => get_option( '_bbp_replies_per_rss_page', 25 ), 1421 1423 'order' => 'DESC', … … 1534 1536 } 1535 1537 1538 /** Post Statuses *************************************************************/ 1539 1540 /** 1541 * Return the public post status ID 1542 * 1543 * @since bbPress (r3504) 1544 * 1545 * @global bbPress $bbp 1546 * @return string 1547 */ 1548 function bbp_get_public_status_id() { 1549 global $bbp; 1550 return $bbp->public_status_id; 1551 } 1552 1553 /** 1554 * Return the private post status ID 1555 * 1556 * @since bbPress (r3504) 1557 * 1558 * @global bbPress $bbp 1559 * @return string 1560 */ 1561 function bbp_get_private_status_id() { 1562 global $bbp; 1563 return $bbp->private_status_id; 1564 } 1565 1566 /** 1567 * Return the hidden post status ID 1568 * 1569 * @since bbPress (r3504) 1570 * 1571 * @global bbPress $bbp 1572 * @return string 1573 */ 1574 function bbp_get_hidden_status_id() { 1575 global $bbp; 1576 return $bbp->hidden_status_id; 1577 } 1578 1579 /** 1580 * Return the closed post status ID 1581 * 1582 * @since bbPress (r3504) 1583 * 1584 * @global bbPress $bbp 1585 * @return string 1586 */ 1587 function bbp_get_closed_status_id() { 1588 global $bbp; 1589 return $bbp->closed_status_id; 1590 } 1591 1592 /** 1593 * Return the spam post status ID 1594 * 1595 * @since bbPress (r3504) 1596 * 1597 * @global bbPress $bbp 1598 * @return string 1599 */ 1600 function bbp_get_spam_status_id() { 1601 global $bbp; 1602 return $bbp->spam_status_id; 1603 } 1604 1605 /** 1606 * Return the trash post status ID 1607 * 1608 * @since bbPress (r3504) 1609 * 1610 * @global bbPress $bbp 1611 * @return string 1612 */ 1613 function bbp_get_trash_status_id() { 1614 global $bbp; 1615 return $bbp->trash_status_id; 1616 } 1617 1618 /** 1619 * Return the orphan post status ID 1620 * 1621 * @since bbPress (r3504) 1622 * 1623 * @global bbPress $bbp 1624 * @return string 1625 */ 1626 function bbp_get_orphan_status_id() { 1627 global $bbp; 1628 return $bbp->orphan_status_id; 1629 } 1630 1536 1631 ?> -
branches/plugin/bbp-includes/bbp-common-template.php
r3472 r3505 253 253 */ 254 254 function bbp_is_topic_tag() { 255 global $bbp ;255 global $bbp, $wp_query; 256 256 257 257 // Return false if editing a topic tag … … 259 259 return false; 260 260 261 if ( is_tax( bbp_get_topic_tag_tax_id() ) || !empty( $bbp->topic_query->is_tax ) )261 if ( is_tax( bbp_get_topic_tag_tax_id() ) || !empty( $bbp->topic_query->is_tax ) || get_query_var( 'bbp_topic_tag' ) ) 262 262 return true; 263 263 … … 919 919 */ 920 920 function bbp_get_dropdown( $args = '' ) { 921 global $bbp;922 921 923 922 /** Arguments *********************************************************/ … … 962 961 963 962 // Public 964 $post_stati[] = 'publish';963 $post_stati[] = bbp_get_public_status_id(); 965 964 966 965 // Forums … … 969 968 // Private forums 970 969 if ( current_user_can( 'read_private_forums' ) ) 971 $post_stati[] = 'private';970 $post_stati[] = bbp_get_private_status_id(); 972 971 973 972 // Hidden forums 974 973 if ( current_user_can( 'read_hidden_forums' ) ) 975 $post_stati[] = $bbp->hidden_status_id;974 $post_stati[] = bbp_get_hidden_status_id(); 976 975 } 977 976 -
branches/plugin/bbp-includes/bbp-core-caps.php
r3504 r3505 165 165 $post_type = get_post_type_object( $post->post_type ); 166 166 167 if ( 'private' != $post->post_status )167 if ( bbp_get_public_status_id() == $post->post_status ) 168 168 $caps[] = 'read'; 169 169 elseif ( (int) $user_id == (int) $post->post_author ) -
branches/plugin/bbp-includes/bbp-core-compatibility.php
r3496 r3505 265 265 'post_content' => '', 266 266 'post_type' => 'page', 267 'post_status' => 'publish',267 'post_status' => bbp_get_public_status_id(), 268 268 'post_name' => '', 269 269 'comment_status' => 'closed', … … 728 728 * 729 729 * @since bbPress (r3032) 730 *731 * @global bbPress $bbp732 * @global WP_Query $post733 730 * 734 731 * @param string $template … … 754 751 */ 755 752 function bbp_template_include_theme_supports( $template = '' ) { 756 global $bbp;757 753 758 754 // Current theme supports bbPress … … 826 822 'post_content' => '', 827 823 'post_type' => bbp_get_forum_post_type(), 828 'post_status' => 'publish',824 'post_status' => bbp_get_public_status_id(), 829 825 'is_archive' => true 830 826 ) ); … … 843 839 'post_content' => '', 844 840 'post_type' => bbp_get_topic_post_type(), 845 'post_status' => 'publish',841 'post_status' => bbp_get_public_status_id(), 846 842 'is_archive' => true 847 843 ) ); … … 875 871 'post_content' => '', 876 872 'post_type' => bbp_get_reply_post_type(), 877 'post_status' => 'publish'873 'post_status' => bbp_get_public_status_id() 878 874 ) ); 879 875 … … 904 900 'post_content' => '', 905 901 'post_type' => '', 906 'post_status' => 'publish'902 'post_status' => bbp_get_public_status_id() 907 903 ) ); 908 904 … … 1580 1576 1581 1577 // All users can see published forums 1582 $status[] = 'publish';1583 1584 // Add 'private'if user is capable1578 $status[] = bbp_get_public_status_id(); 1579 1580 // Add bbp_get_private_status_id() if user is capable 1585 1581 if ( current_user_can( 'read_private_forums' ) ) 1586 $status[] = 'private';1587 1588 // Add 'hidden'if user is capable1582 $status[] = bbp_get_private_status_id(); 1583 1584 // Add bbp_get_hidden_status_id() if user is capable 1589 1585 if ( current_user_can( 'read_hidden_forums' ) ) 1590 $status[] = $bbp->hidden_status_id;1586 $status[] = bbp_get_hidden_status_id(); 1591 1587 1592 1588 // Implode and add the statuses … … 1595 1591 // Topic tag page 1596 1592 } elseif ( bbp_is_topic_tag() ) { 1593 $posts_query->set( 'bbp_topic_tag', get_query_var( 'term' ) ); 1597 1594 $posts_query->set( 'post_type', bbp_get_topic_post_type() ); 1598 1595 $posts_query->set( 'posts_per_page', get_option( '_bbp_topics_per_page', 15 ) ); -
branches/plugin/bbp-includes/bbp-core-shortcodes.php
r3395 r3505 757 757 * @since bbPress (r3302) 758 758 * 759 * @global bbPress $bbp760 *761 759 * @return string 762 760 */ 763 761 public function display_login() { 764 global $bbp;765 762 766 763 // Unset globals … … 785 782 * @since bbPress (r3302) 786 783 * 787 * @global bbPress $bbp788 *789 784 * @return string 790 785 */ 791 786 public function display_register() { 792 global $bbp;793 787 794 788 // Unset globals … … 813 807 * @since bbPress (r3302) 814 808 * 815 * @global bbPress $bbp816 *817 809 * @return string 818 810 */ 819 811 public function display_lost_pass() { 820 global $bbp;821 812 822 813 // Unset globals … … 842 833 * 843 834 * @since bbPress (r3302) 844 *845 * @global bbPress $bbp846 835 * 847 836 * @return string … … 875 864 global $bbp; 876 865 866 // Bail if bbPress is not loaded 867 if ( 'bbPress' !== get_class( $bbp ) ) return; 868 877 869 $bbp->shortcodes = new BBP_Shortcodes(); 878 870 } -
branches/plugin/bbp-includes/bbp-core-widgets.php
r3491 r3505 530 530 */ 531 531 function widget( $args, $instance ) { 532 global $bbp;533 532 534 533 extract( $args ); … … 727 726 */ 728 727 function widget( $args, $instance ) { 729 global $bbp;730 728 731 729 extract( $args ); … … 737 735 // Query defaults 738 736 $replies_query = array( 739 'post_status' => join( ',', array( 'publish', $bbp->closed_status_id) ),737 'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ), 740 738 'posts_per_page' => $max_shown, 741 739 'order' => 'DESC' -
branches/plugin/bbp-includes/bbp-extend-akismet.php
r3498 r3505 74 74 * @param string $post_data 75 75 * 76 * @global bbPress $bbp77 *78 76 * @uses get_userdata() To get the user data 79 77 * @uses bbp_filter_anonymous_user_data() To get anonymous user data … … 89 87 */ 90 88 public function check_post( $post_data ) { 91 global $bbp;92 89 93 90 // Declare local variables … … 96 93 97 94 // Post is not published 98 if ( 'publish'!= $post_data['post_status'] )95 if ( bbp_get_public_status_id() != $post_data['post_status'] ) 99 96 return $post_data; 100 97 … … 167 164 168 165 // This is spam 169 $post_data['post_status'] = $bbp->spam_status_id;166 $post_data['post_status'] = bbp_get_spam_status_id(); 170 167 171 168 // We don't want your spam tags here … … 192 189 * @param int $post_id 193 190 * 194 * @global bbPress $bbp195 191 * @global WP_Query $wpdb 196 192 * @global string $akismet_api_host … … 214 210 */ 215 211 public function submit_post( $post_id = 0 ) { 216 global $ bbp, $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site;212 global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site; 217 213 218 214 // Innocent until proven guilty … … 251 247 252 248 // Bail if we're spamming, but the post_status isn't spam 253 if ( ( 'spam' == $request_type ) && ( $bbp->spam_status_id!= $post->post_status ) )249 if ( ( 'spam' == $request_type ) && ( bbp_get_spam_status_id() != $post->post_status ) ) 254 250 return; 255 251 … … 404 400 * @param object $post 405 401 * 406 * @global bbPress $bbp407 402 * @global object $this->last_post 408 403 * … … 414 409 */ 415 410 public function update_post_meta( $post_id = 0, $post = false ) { 416 global $bbp;417 411 418 412 // Define local variable(s) … … 452 446 453 447 // If post_status isn't the spam status, as expected, leave a note 454 if ( $post->post_status != $bbp->spam_status_id) {448 if ( $post->post_status != bbp_get_spam_status_id() ) { 455 449 $this->update_post_history( $post_id, sprintf( __( 'Post status was changed to %s', 'bbpress' ), $post->post_status ), 'status-changed-' . $post->post_status ); 456 450 } … … 464 458 465 459 // If post_status is the spam status, which isn't expected, leave a note 466 if ( $post->post_status == $bbp->spam_status_id) {460 if ( $post->post_status == bbp_get_spam_status_id() ) { 467 461 468 462 // @todo Use wp_blacklist_check() … … 554 548 * @param int $reply_id 555 549 * 556 * @global bbPress $bbp557 *558 550 * @uses bbp_get_reply_id() To get the reply_id 559 551 * @uses bbp_get_topic_id() To get the topic_id … … 564 556 */ 565 557 public function filter_post_terms( $terms = '', $topic_id = 0, $reply_id = 0 ) { 566 global $bbp;567 558 568 559 // Validate the reply_id and topic_id … … 696 687 if ( !defined( 'AKISMET_VERSION' ) ) return; 697 688 689 // Bail if bbPress is not loaded 690 if ( 'bbPress' !== get_class( $bbp ) ) return; 691 698 692 // Instantiate Akismet for bbPress 699 693 $bbp->extend->akismet = new BBP_Akismet(); -
branches/plugin/bbp-includes/bbp-extend-buddypress.php
r3503 r3505 597 597 if ( !empty( $bp->maintenance_mode ) || !defined( 'BP_VERSION' ) ) return; 598 598 599 // Bail if bbPress is not loaded 600 if ( 'bbPress' !== get_class( $bbp ) ) return; 601 599 602 // Instantiate BuddyPress for bbPress 600 603 $bbp->extend->buddypress = new BBP_BuddyPress(); -
branches/plugin/bbp-includes/bbp-extend-genesis.php
r3500 r3505 163 163 if ( basename( TEMPLATEPATH ) !== 'genesis' ) return; 164 164 165 // Bail if bbPress is not loaded 166 if ( 'bbPress' !== get_class( $bbp ) ) return; 167 165 168 // Instantiate Genesis for bbPress 166 169 $bbp->extend->genesis = new BBP_Genesis(); -
branches/plugin/bbp-includes/bbp-forum-functions.php
r3501 r3505 32 32 $default_forum = array( 33 33 'post_parent' => 0, // forum ID 34 'post_status' => 'publish',34 'post_status' => bbp_get_public_status_id(), 35 35 'post_type' => bbp_get_forum_post_type(), 36 36 'post_author' => 0, … … 208 208 209 209 // Only run queries if visibility is changing 210 if ( 'publish'!= $current_visibility ) {210 if ( bbp_get_public_status_id() != $current_visibility ) { 211 211 212 212 // Remove from _bbp_private_forums site option 213 if ( 'private'== $current_visibility ) {213 if ( bbp_get_private_status_id() == $current_visibility ) { 214 214 215 215 // Get private forums … … 230 230 231 231 // Remove from _bbp_hidden_forums site option 232 if ( 'hidden'== $current_visibility ) {232 if ( bbp_get_hidden_status_id() == $current_visibility ) { 233 233 234 234 // Get hidden forums … … 250 250 // Update forum post_status 251 251 global $wpdb; 252 $wpdb->update( $wpdb->posts, array( 'post_status' => 'publish'), array( 'ID' => $forum_id ) );253 wp_transition_post_status( 'publish', $current_visibility, get_post( $forum_id ) );252 $wpdb->update( $wpdb->posts, array( 'post_status' => bbp_get_public_status_id() ), array( 'ID' => $forum_id ) ); 253 wp_transition_post_status( bbp_get_public_status_id(), $current_visibility, get_post( $forum_id ) ); 254 254 } 255 255 … … 275 275 276 276 // Only run queries if visibility is changing 277 if ( 'private'!= $current_visibility ) {277 if ( bbp_get_private_status_id() != $current_visibility ) { 278 278 279 279 // Remove from _bbp_hidden_forums site option 280 if ( 'hidden'== $current_visibility ) {280 if ( bbp_get_hidden_status_id() == $current_visibility ) { 281 281 282 282 // Get hidden forums … … 303 303 // Update forums visibility setting 304 304 global $wpdb; 305 $wpdb->update( $wpdb->posts, array( 'post_status' => 'private'), array( 'ID' => $forum_id ) );306 wp_transition_post_status( 'private', $current_visibility, get_post( $forum_id ) );305 $wpdb->update( $wpdb->posts, array( 'post_status' => bbp_get_private_status_id() ), array( 'ID' => $forum_id ) ); 306 wp_transition_post_status( bbp_get_private_status_id(), $current_visibility, get_post( $forum_id ) ); 307 307 } 308 308 … … 328 328 329 329 // Only run queries if visibility is changing 330 if ( 'hidden'!= $current_visibility ) {330 if ( bbp_get_hidden_status_id() != $current_visibility ) { 331 331 332 332 // Remove from _bbp_private_forums site option 333 if ( 'private'== $current_visibility ) {333 if ( bbp_get_private_status_id() == $current_visibility ) { 334 334 335 335 // Get private forums … … 355 355 356 356 // Update forums visibility setting 357 global $ bbp, $wpdb;358 $wpdb->update( $wpdb->posts, array( 'post_status' => 'hidden'), array( 'ID' => $forum_id ) );359 wp_transition_post_status( $bbp->hidden_status_id, $current_visibility, get_post( $forum_id ) );357 global $wpdb; 358 $wpdb->update( $wpdb->posts, array( 'post_status' => bbp_get_hidden_status_id() ), array( 'ID' => $forum_id ) ); 359 wp_transition_post_status( bbp_get_hidden_status_id(), $current_visibility, get_post( $forum_id ) ); 360 360 } 361 361 … … 511 511 */ 512 512 function bbp_update_forum_last_active_id( $forum_id = 0, $active_id = 0 ) { 513 513 514 $forum_id = bbp_get_forum_id( $forum_id ); 514 515 … … 544 545 545 546 // Update only if published 546 if ( 'publish'== get_post_status( $active_id ) )547 if ( bbp_get_public_status_id() == get_post_status( $active_id ) ) 547 548 update_post_meta( $forum_id, '_bbp_last_active_id', (int) $active_id ); 548 549 … … 661 662 */ 662 663 function bbp_update_forum_topic_count_hidden( $forum_id = 0, $topic_count = 0 ) { 663 global $wpdb , $bbp;664 global $wpdb; 664 665 665 666 // If topic_id was passed as $forum_id, then get its forum … … 678 679 // Get topics of forum 679 680 if ( empty( $topic_count ) ) 680 $topic_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( '" . join( '\',\'', array( $bbp->trash_status_id, $bbp->spam_status_id) ) . "') AND post_type = '%s';", $forum_id, bbp_get_topic_post_type() ) );681 $topic_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( '" . join( '\',\'', array( bbp_get_trash_status_id(), bbp_get_spam_status_id() ) ) . "') AND post_type = '%s';", $forum_id, bbp_get_topic_post_type() ) ); 681 682 682 683 // Update the count … … 709 710 */ 710 711 function bbp_update_forum_reply_count( $forum_id = 0 ) { 711 global $wpdb , $bbp;712 global $wpdb; 712 713 713 714 $forum_id = bbp_get_forum_id( $forum_id ); … … 721 722 // Don't count replies if the forum is a category 722 723 if ( $topic_ids = bbp_forum_query_topic_ids( $forum_id ) ) 723 $reply_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent IN ( " . join( ',', $topic_ids ) . " ) AND post_status = ' publish' AND post_type = '%s';", bbp_get_reply_post_type() ) );724 $reply_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent IN ( " . join( ',', $topic_ids ) . " ) AND post_status = '%s' AND post_type = '%s';", bbp_get_public_status_id(), bbp_get_reply_post_type() ) ); 724 725 else 725 726 $reply_count = 0; … … 768 769 'last_active_id' => 0, 769 770 'last_active_time' => 0, 770 'last_active_status' => 'publish'771 'last_active_status' => bbp_get_public_status_id() 771 772 ); 772 773 … … 785 786 $last_active_time = get_post_field( 'post_date', $last_active_id ); 786 787 787 if ( 'publish'== $last_active_status ) {788 if ( bbp_get_public_status_id() == $last_active_status ) { 788 789 bbp_update_forum_last_active_time( $forum_id, $last_active_time ); 789 790 } … … 980 981 */ 981 982 function bbp_forum_query_topic_ids( $forum_id ) { 982 global $bbp;983 984 983 $topic_ids = bbp_get_public_child_ids( $forum_id, bbp_get_topic_post_type() ); 985 984 … … 1001 1000 */ 1002 1001 function bbp_forum_query_subforum_ids( $forum_id ) { 1003 global $bbp, $wpdb;1004 1005 1002 $subforum_ids = bbp_get_public_child_ids( $forum_id, bbp_get_forum_post_type() ); 1006 1003 … … 1025 1022 */ 1026 1023 function bbp_forum_query_last_reply_id( $forum_id, $topic_ids = 0 ) { 1027 global $ bbp, $wpdb;1024 global $wpdb; 1028 1025 1029 1026 $cache_id = 'bbp_get_forum_' . $forum_id . '_reply_id'; … … 1034 1031 $topic_ids = bbp_forum_query_topic_ids( $forum_id ); 1035 1032 1036 if ( !empty( $topic_ids ) && ( $reply_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent IN ( " . join( ',', $topic_ids ) . " ) AND post_status = ' publish' AND post_type = '%s' ORDER BY ID DESC LIMIT 1;", bbp_get_reply_post_type() ) ) ) )1033 if ( !empty( $topic_ids ) && ( $reply_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent IN ( " . join( ',', $topic_ids ) . " ) AND post_status = '%s' AND post_type = '%s' ORDER BY ID DESC LIMIT 1;", bbp_get_public_status_id(), bbp_get_reply_post_type() ) ) ) ) 1037 1034 wp_cache_set( $cache_id, $reply_id, 'bbpress' ); 1038 1035 else -
branches/plugin/bbp-includes/bbp-forum-template.php
r3496 r3505 62 62 63 63 // Setup possible post__not_in array 64 $post_stati[] = 'publish';64 $post_stati[] = bbp_get_public_status_id(); 65 65 66 66 // Super admin get whitelisted post statuses 67 67 if ( is_super_admin() ) { 68 $post_stati = array( 'publish', 'private', 'hidden');68 $post_stati = array( bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id() ); 69 69 70 70 // Not a super admin, so check caps … … 73 73 // Check if user can read private forums 74 74 if ( current_user_can( 'read_private_forums' ) ) 75 $post_stati[] = 'private';75 $post_stati[] = bbp_get_private_status_id(); 76 76 77 77 // Check if user can read hidden forums 78 78 if ( current_user_can( 'read_hidden_forums' ) ) 79 $post_stati[] = 'hidden';79 $post_stati[] = bbp_get_hidden_status_id(); 80 80 } 81 81 … … 580 580 581 581 // Setup possible post__not_in array 582 $post_stati[] = 'publish';582 $post_stati[] = bbp_get_public_status_id(); 583 583 584 584 // Super admin get whitelisted post statuses 585 585 if ( is_super_admin() ) { 586 $post_stati = array( 'publish', 'private', 'hidden');586 $post_stati = array( bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id() ); 587 587 588 588 // Not a super admin, so check caps … … 591 591 // Check if user can read private forums 592 592 if ( current_user_can( 'read_private_forums' ) ) 593 $post_stati[] = 'private';593 $post_stati[] = bbp_get_private_status_id(); 594 594 595 595 // Check if user can read hidden forums 596 596 if ( current_user_can( 'read_hidden_forums' ) ) 597 $post_stati[] = 'hidden';597 $post_stati[] = bbp_get_hidden_status_id(); 598 598 } 599 599 … … 636 636 */ 637 637 function bbp_list_forums( $args = '' ) { 638 global $bbp;639 638 640 639 // Define used variables … … 1077 1076 */ 1078 1077 function bbp_get_forum_topics_link( $forum_id = 0 ) { 1079 global $bbp;1080 1078 1081 1079 $forum = bbp_get_forum( bbp_get_forum_id( (int) $forum_id ) ); … … 1375 1373 */ 1376 1374 function bbp_is_forum_closed( $forum_id = 0, $check_ancestors = true ) { 1377 global $bbp; 1378 1379 $forum_id = bbp_get_forum_id( $forum_id ); 1380 $retval = ( $bbp->closed_status_id == bbp_get_forum_status( $forum_id ) ); 1375 1376 $forum_id = bbp_get_forum_id( $forum_id ); 1377 $retval = ( bbp_get_closed_status_id() == bbp_get_forum_status( $forum_id ) ); 1381 1378 1382 1379 if ( !empty( $check_ancestors ) ) { … … 1408 1405 */ 1409 1406 function bbp_is_forum_public( $forum_id = 0, $check_ancestors = true ) { 1410 global $bbp;1411 1407 1412 1408 $forum_id = bbp_get_forum_id( $forum_id ); … … 1414 1410 1415 1411 // If post status is public, return true 1416 $retval = ( 'publish'== $visibility );1412 $retval = ( bbp_get_public_status_id() == $visibility ); 1417 1413 1418 1414 // Check ancestors and inherit their privacy setting for display … … 1445 1441 */ 1446 1442 function bbp_is_forum_private( $forum_id = 0, $check_ancestors = true ) { 1447 global $bbp;1448 1443 1449 1444 $forum_id = bbp_get_forum_id( $forum_id ); … … 1451 1446 1452 1447 // If post status is private, return true 1453 $retval = ( 'private'== $visibility );1448 $retval = ( bbp_get_private_status_id() == $visibility ); 1454 1449 1455 1450 // Check ancestors and inherit their privacy setting for display … … 1482 1477 */ 1483 1478 function bbp_is_forum_hidden( $forum_id = 0, $check_ancestors = true ) { 1484 global $bbp;1485 1479 1486 1480 $forum_id = bbp_get_forum_id( $forum_id ); … … 1488 1482 1489 1483 // If post status is private, return true 1490 $retval = ( 'hidden'== $visibility );1484 $retval = ( bbp_get_hidden_status_id() == $visibility ); 1491 1485 1492 1486 // Check ancestors and inherit their privacy setting for display -
branches/plugin/bbp-includes/bbp-reply-functions.php
r3501 r3505 32 32 $default_reply = array( 33 33 'post_parent' => 0, // topic ID 34 'post_status' => 'publish',34 'post_status' => bbp_get_public_status_id(), 35 35 'post_type' => bbp_get_reply_post_type(), 36 36 'post_author' => 0, … … 116 116 return; 117 117 118 global $bbp;119 120 118 // Nonce check 121 119 check_admin_referer( 'bbp-new-reply' ); … … 232 230 'post_content' => $reply_content, 233 231 'post_parent' => $topic_id, 234 'post_status' => 'publish',232 'post_status' => bbp_get_public_status_id(), 235 233 'post_type' => bbp_get_reply_post_type() 236 234 ); … … 264 262 // If this reply starts as trash, add it to pre_trashed_replies 265 263 // for the topic, so it is properly restored. 266 if ( bbp_is_topic_trash( $topic_id ) || ( $reply_data['post_status'] == $bbp->trash_status_id) ) {264 if ( bbp_is_topic_trash( $topic_id ) || ( $reply_data['post_status'] == bbp_get_trash_status_id() ) ) { 267 265 268 266 // Trash the reply … … 282 280 283 281 // If reply or topic are spam, officially spam this reply 284 if ( bbp_is_topic_spam( $topic_id ) || ( $reply_data['post_status'] == $bbp->spam_status_id) )285 add_post_meta( $reply_id, '_bbp_spam_meta_status', 'publish');282 if ( bbp_is_topic_spam( $topic_id ) || ( $reply_data['post_status'] == bbp_get_spam_status_id() ) ) 283 add_post_meta( $reply_id, '_bbp_spam_meta_status', bbp_get_public_status_id() ); 286 284 287 285 /** Update counts, etc... *****************************************/ … … 1078 1076 */ 1079 1077 function bbp_spam_reply( $reply_id = 0 ) { 1080 global $bbp;1081 1078 1082 1079 // Get reply … … 1085 1082 1086 1083 // Bail if already spam 1087 if ( $reply['post_status'] == $bbp->spam_status_id)1084 if ( bbp_get_spam_status_id() == $reply['post_status'] ) 1088 1085 return false; 1089 1086 … … 1095 1092 1096 1093 // Set post status to spam 1097 $reply['post_status'] = $bbp->spam_status_id;1094 $reply['post_status'] = bbp_get_spam_status_id(); 1098 1095 1099 1096 // No revisions … … 1125 1122 */ 1126 1123 function bbp_unspam_reply( $reply_id = 0 ) { 1127 global $bbp;1128 1124 1129 1125 // Get reply … … 1132 1128 1133 1129 // Bail if already not spam 1134 if ( $reply['post_status'] != $bbp->spam_status_id)1130 if ( bbp_get_spam_status_id() != $reply['post_status'] ) 1135 1131 return false; 1136 1132 -
branches/plugin/bbp-includes/bbp-reply-template.php
r3501 r3505 70 70 71 71 // Default status 72 $default_status = join( ',', array( 'publish', $bbp->closed_status_id) );72 $default_status = join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ); 73 73 74 74 // Skip topic_id if in the replies widget query … … 84 84 // What are the default allowed statuses (based on user caps) 85 85 if ( bbp_get_view_all( 'edit_others_replies' ) ) { 86 $default_status = join( ',', array( 'publish', $bbp->closed_status_id, $bbp->spam_status_id, 'trash' ) );86 $default_status = join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), 'trash' ) ); 87 87 } 88 88 } … … 369 369 */ 370 370 function bbp_get_reply_url( $reply_id = 0, $redirect_to = '' ) { 371 global $ bbp, $wp_rewrite;371 global $wp_rewrite; 372 372 373 373 // Set needed variables … … 692 692 function bbp_get_reply_status( $reply_id = 0 ) { 693 693 $reply_id = bbp_get_reply_id( $reply_id ); 694 695 694 return apply_filters( 'bbp_get_reply_status', get_post_status( $reply_id ), $reply_id ); 696 695 } … … 707 706 */ 708 707 function bbp_is_reply_published( $reply_id = 0 ) { 709 global $bbp;710 711 708 $reply_status = bbp_get_reply_status( bbp_get_reply_id( $reply_id ) ); 712 return apply_filters( 'bbp_is_reply_published', 'publish'== $reply_status, $reply_id );709 return apply_filters( 'bbp_is_reply_published', bbp_get_public_status_id() == $reply_status, $reply_id ); 713 710 } 714 711 … … 724 721 */ 725 722 function bbp_is_reply_spam( $reply_id = 0 ) { 726 global $bbp;727 728 723 $reply_status = bbp_get_reply_status( bbp_get_reply_id( $reply_id ) ); 729 730 return apply_filters( 'bbp_is_reply_spam', $bbp->spam_status_id == $reply_status, $reply_id ); 724 return apply_filters( 'bbp_is_reply_spam', bbp_get_spam_status_id() == $reply_status, $reply_id ); 731 725 } 732 726 … … 742 736 */ 743 737 function bbp_is_reply_trash( $reply_id = 0 ) { 744 global $bbp;745 746 738 $reply_status = bbp_get_reply_status( bbp_get_reply_id( $reply_id ) ); 747 748 return apply_filters( 'bbp_is_reply_trash', $bbp->trash_status_id == $reply_status, $reply_id ); 739 return apply_filters( 'bbp_is_reply_trash', bbp_get_trash_status_id() == $reply_status, $reply_id ); 749 740 } 750 741 … … 1337 1328 */ 1338 1329 function bbp_get_reply_admin_links( $args = '' ) { 1339 global $bbp;1340 1330 1341 1331 $defaults = array ( … … 1383 1373 // See if links need to be unset 1384 1374 $reply_status = bbp_get_reply_status( $r['id'] ); 1385 if ( in_array( $reply_status, array( $bbp->spam_status_id, $bbp->trash_status_id) ) ) {1375 if ( in_array( $reply_status, array( bbp_get_spam_status_id(), bbp_get_trash_status_id() ) ) ) { 1386 1376 1387 1377 // Spam link shouldn't be visible on trashed topics 1388 if ( $reply_status == $bbp->trash_status_id)1378 if ( $reply_status == bbp_get_trash_status_id() ) 1389 1379 unset( $r['links']['spam'] ); 1390 1380 1391 1381 // Trash link shouldn't be visible on spam topics 1392 elseif ( isset( $r['links']['trash'] ) && $reply_status == $bbp->spam_status_id)1382 elseif ( isset( $r['links']['trash'] ) && $reply_status == bbp_get_spam_status_id() ) 1393 1383 unset( $r['links']['trash'] ); 1394 1384 } -
branches/plugin/bbp-includes/bbp-topic-functions.php
r3501 r3505 32 32 $default_topic = array( 33 33 'post_parent' => 0, // forum ID 34 'post_status' => 'publish',34 'post_status' => bbp_get_public_status_id(), 35 35 'post_type' => bbp_get_topic_post_type(), 36 36 'post_author' => 0, … … 124 124 return; 125 125 126 global $bbp;127 128 126 // Nonce check 129 127 check_admin_referer( 'bbp-new-topic' ); … … 268 266 'post_parent' => $forum_id, 269 267 'tax_input' => $terms, 270 'post_status' => 'publish',268 'post_status' => bbp_get_public_status_id(), 271 269 'post_type' => bbp_get_topic_post_type() 272 270 ); … … 310 308 // If the forum is trash, or the topic_status is switched to 311 309 // trash, trash it properly 312 if ( ( get_post_field( 'post_status', $forum_id ) == $bbp->trash_status_id ) || ( $topic_data['post_status'] == $bbp->trash_status_id) ) {310 if ( ( get_post_field( 'post_status', $forum_id ) == bbp_get_trash_status_id() ) || ( $topic_data['post_status'] == bbp_get_trash_status_id() ) ) { 313 311 314 312 // Trash the reply … … 322 320 323 321 // If reply or topic are spam, officially spam this reply 324 if ( $topic_data['post_status'] == $bbp->spam_status_id) {325 add_post_meta( $topic_id, '_bbp_spam_meta_status', 'publish');322 if ( $topic_data['post_status'] == bbp_get_spam_status_id() ) { 323 add_post_meta( $topic_id, '_bbp_spam_meta_status', bbp_get_public_status_id() ); 326 324 327 325 // Force view=all … … 817 815 if ( true == $refresh ) { 818 816 $forum_id = $topic_id = $reply_id = $active_id = $last_active_time = 0; 819 $topic_status = 'publish';817 $topic_status = bbp_get_public_status_id(); 820 818 } 821 819 … … 1279 1277 return; 1280 1278 1281 global $wpdb , $bbp;1279 global $wpdb; 1282 1280 1283 1281 // Prevent debug notices … … 2122 2120 */ 2123 2121 function bbp_update_topic_reply_count_hidden( $topic_id = 0, $reply_count = 0 ) { 2124 global $wpdb , $bbp;2122 global $wpdb; 2125 2123 2126 2124 // If it's a reply, then get the parent (topic id) … … 2132 2130 // Get replies of topic 2133 2131 if ( empty( $reply_count ) ) 2134 $reply_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( '" . join( '\',\'', array( $bbp->trash_status_id, $bbp->spam_status_id) ) . "') AND post_type = '%s';", $topic_id, bbp_get_reply_post_type() ) );2132 $reply_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( '" . join( '\',\'', array( bbp_get_trash_status_id(), bbp_get_spam_status_id() ) ) . "') AND post_type = '%s';", $topic_id, bbp_get_reply_post_type() ) ); 2135 2133 2136 2134 update_post_meta( $topic_id, '_bbp_reply_count_hidden', (int) $reply_count ); … … 2173 2171 2174 2172 // Update only if published 2175 if ( 'publish'== get_post_status( $active_id ) )2173 if ( bbp_get_public_status_id() == get_post_status( $active_id ) ) 2176 2174 update_post_meta( $topic_id, '_bbp_last_active_id', (int) $active_id ); 2177 2175 … … 2285 2283 2286 2284 // Query the DB to get voices in this topic 2287 $voices = $wpdb->get_col( $wpdb->prepare( "SELECT COUNT( DISTINCT post_author ) FROM {$wpdb->posts} WHERE ( post_parent = %d AND post_status = ' publish' AND post_type = '%s' ) OR ( ID = %d AND post_type = '%s' );", $topic_id, bbp_get_reply_post_type(), $topic_id, bbp_get_topic_post_type() ) );2285 $voices = $wpdb->get_col( $wpdb->prepare( "SELECT COUNT( DISTINCT post_author ) FROM {$wpdb->posts} WHERE ( post_parent = %d AND post_status = '%s' AND post_type = '%s' ) OR ( ID = %d AND post_type = '%s' );", $topic_id, bbp_get_public_status_id(), bbp_get_reply_post_type(), $topic_id, bbp_get_topic_post_type() ) ); 2288 2286 2289 2287 // If there's an error, make sure we at least have 1 voice … … 2326 2324 return; 2327 2325 2328 $anonymous_replies = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( ID ) FROM {$wpdb->posts} WHERE ( post_parent = %d AND post_status = ' publish' AND post_type = '%s' AND post_author = 0 ) OR ( ID = %d AND post_type = '%s' AND post_author = 0 );", $topic_id, bbp_get_reply_post_type(), $topic_id, bbp_get_topic_post_type() ) );2326 $anonymous_replies = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( ID ) FROM {$wpdb->posts} WHERE ( post_parent = %d AND post_status = '%s' AND post_type = '%s' AND post_author = 0 ) OR ( ID = %d AND post_type = '%s' AND post_author = 0 );", $topic_id, bbp_get_public_status_id(), bbp_get_reply_post_type(), $topic_id, bbp_get_topic_post_type() ) ); 2329 2327 2330 2328 update_post_meta( $topic_id, '_bbp_anonymous_reply_count', (int) $anonymous_replies ); … … 2391 2389 */ 2392 2390 function bbp_close_topic( $topic_id = 0 ) { 2393 global $bbp;2394 2391 2395 2392 // Get topic … … 2398 2395 2399 2396 // Bail if already closed 2400 if ( $topic['post_status'] == $bbp->closed_status_id)2397 if ( bbp_get_closed_status_id == $topic['post_status'] ) 2401 2398 return false; 2402 2399 … … 2408 2405 2409 2406 // Set closed status 2410 $topic['post_status'] = $bbp->closed_status_id;2407 $topic['post_status'] = bbp_get_closed_status_id(); 2411 2408 2412 2409 // No revisions … … 2438 2435 */ 2439 2436 function bbp_open_topic( $topic_id = 0 ) { 2440 global $bbp;2441 2437 2442 2438 // Get topic … … 2445 2441 2446 2442 // Bail if already open 2447 if ( $topic['post_status'] != $bbp->closed_status_id)2443 if ( bbp_get_closed_status_id() != $topic['post_status']) 2448 2444 return false; 2449 2445 … … 2487 2483 */ 2488 2484 function bbp_spam_topic( $topic_id = 0 ) { 2489 global $bbp;2490 2485 2491 2486 // Get the topic … … 2494 2489 2495 2490 // Bail if topic is spam 2496 if ( $topic['post_status'] == $bbp->spam_status_id)2491 if ( bbp_get_spam_status_id() == $topic['post_status'] ) 2497 2492 return false; 2498 2493 … … 2526 2521 2527 2522 // Set post status to spam 2528 $topic['post_status'] = $bbp->spam_status_id;2523 $topic['post_status'] = bbp_get_spam_status_id(); 2529 2524 2530 2525 // No revisions … … 2556 2551 */ 2557 2552 function bbp_unspam_topic( $topic_id = 0 ) { 2558 global $bbp;2559 2553 2560 2554 // Get the topic … … 2563 2557 2564 2558 // Bail if already not spam 2565 if ( $topic['post_status'] != $bbp->spam_status_id)2559 if ( bbp_get_spam_status_id() != $topic['post_status'] ) 2566 2560 return false; 2567 2561 … … 2713 2707 */ 2714 2708 function bbp_delete_topic( $topic_id = 0 ) { 2715 global $bbp;2716 2709 2717 2710 // Validate topic ID … … 2724 2717 2725 2718 // Valid topic/reply statuses 2726 $post_stati = join( ',', array( 'publish', $bbp->spam_status_id, 'trash' ) );2719 $post_stati = join( ',', array( bbp_get_public_status_id(), bbp_get_spam_status_id(), 'trash' ) ); 2727 2720 2728 2721 // Topic is being permanently deleted, so its replies gotta go too … … 2774 2767 if ( bbp_has_replies( array( 2775 2768 'post_type' => bbp_get_reply_post_type(), 2776 'post_status' => 'publish',2769 'post_status' => bbp_get_public_status_id(), 2777 2770 'posts_per_page' => -1, 2778 2771 'meta_query' => array( array( -
branches/plugin/bbp-includes/bbp-topic-template.php
r3501 r3505 71 71 // What are the default allowed statuses (based on user caps) 72 72 if ( !bbp_is_query_name( 'bbp_widget' ) && bbp_get_view_all() ) 73 $default_status = join( ',', array( 'publish', $bbp->closed_status_id, $bbp->spam_status_id, 'trash') );73 $default_status = join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id() ) ); 74 74 else 75 $default_status = join( ',', array( 'publish', $bbp->closed_status_id) );75 $default_status = join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ); 76 76 77 77 // Default arguments … … 121 121 extract( $bbp_t ); 122 122 123 // If we're viewing a tax/term, use the existing query; if not, run our own 124 if ( bbp_is_topic_tag() && !bbp_is_query_name( 'bbp_widget' ) ) 125 $bbp->topic_query = $wp_query; 126 else 127 $bbp->topic_query = new WP_Query( $bbp_t ); 123 // Call the query 124 $bbp->topic_query = new WP_Query( $bbp_t ); 128 125 129 126 // Set post_parent back to 0 if originally set to 'any' … … 904 901 */ 905 902 function bbp_is_topic_closed( $topic_id = 0 ) { 906 global $bbp; 907 908 if ( $bbp->closed_status_id == bbp_get_topic_status( $topic_id ) ) 903 if ( bbp_get_closed_status_id() == bbp_get_topic_status( $topic_id ) ) 909 904 return true; 910 905 … … 966 961 */ 967 962 function bbp_is_topic_published( $topic_id = 0 ) { 968 global $bbp;969 970 963 $topic_status = bbp_get_topic_status( bbp_get_topic_id( $topic_id ) ); 971 return 'publish'== $topic_status;964 return bbp_get_public_status_id() == $topic_status; 972 965 } 973 966 … … 983 976 */ 984 977 function bbp_is_topic_spam( $topic_id = 0 ) { 985 global $bbp;986 987 978 $topic_status = bbp_get_topic_status( bbp_get_topic_id( $topic_id ) ); 988 return $bbp->spam_status_id== $topic_status;979 return bbp_get_spam_status_id() == $topic_status; 989 980 } 990 981 … … 1000 991 */ 1001 992 function bbp_is_topic_trash( $topic_id = 0 ) { 1002 global $bbp;1003 1004 993 $topic_status = bbp_get_topic_status( bbp_get_topic_id( $topic_id ) ); 1005 return $bbp->trash_status_id== $topic_status;994 return bbp_get_trash_status_id() == $topic_status; 1006 995 } 1007 996 … … 1703 1692 */ 1704 1693 function bbp_get_topic_replies_link( $topic_id = 0 ) { 1705 global $bbp;1706 1694 1707 1695 $topic = bbp_get_topic( bbp_get_topic_id( (int) $topic_id ) ); … … 1990 1978 */ 1991 1979 function bbp_get_topic_admin_links( $args = '' ) { 1992 global $bbp;1993 1980 1994 1981 if ( !bbp_is_single_topic() ) … … 2025 2012 // See if links need to be unset 2026 2013 $topic_status = bbp_get_topic_status( $r['id'] ); 2027 if ( in_array( $topic_status, array( $bbp->spam_status_id, $bbp->trash_status_id) ) ) {2014 if ( in_array( $topic_status, array( bbp_get_spam_status_id(), bbp_get_trash_status_id() ) ) ) { 2028 2015 2029 2016 // Close link shouldn't be visible on trashed/spammed topics … … 2031 2018 2032 2019 // Spam link shouldn't be visible on trashed topics 2033 if ( $topic_status == $bbp->trash_status_id)2020 if ( $topic_status == bbp_get_trash_status_id() ) 2034 2021 unset( $r['links']['spam'] ); 2035 2022 2036 2023 // Trash link shouldn't be visible on spam topics 2037 elseif ( $topic_status == $bbp->spam_status_id)2024 elseif ( $topic_status == bbp_get_spam_status_id() ) 2038 2025 unset( $r['links']['trash'] ); 2039 2026 } … … 2187 2174 */ 2188 2175 function bbp_get_topic_trash_link( $args = '' ) { 2189 global $bbp;2190 2176 2191 2177 $defaults = array ( … … 2576 2562 */ 2577 2563 function bbp_topic_notices() { 2578 global $bbp;2579 2564 2580 2565 // Bail if not viewing a topic … … 2589 2574 2590 2575 // Spam notice 2591 case $bbp->spam_status_id:2576 case bbp_get_spam_status_id() : 2592 2577 $notice_text = __( 'This topic is marked as spam.', 'bbpress' ); 2593 2578 break; 2594 2579 2595 2580 // Trashed notice 2596 case $bbp->trash_status_id:2581 case bbp_get_trash_status_id() : 2597 2582 $notice_text = __( 'This topic is in the trash.', 'bbpress' ); 2598 2583 break; … … 3025 3010 */ 3026 3011 function bbp_get_topic_tag_description( $args = array() ) { 3027 global $bbp;3028 3012 3029 3013 $defaults = array( … … 3145 3129 */ 3146 3130 function bbp_get_form_topic_tags() { 3147 global $post , $bbp;3131 global $post; 3148 3132 3149 3133 // Get _POST data -
branches/plugin/bbp-includes/bbp-user-functions.php
r3504 r3505 1023 1023 1024 1024 // Make array of post types to mark as spam 1025 $post_types = array( bbp_get_topic_post_type(), bbp_get_reply_post_type() ); 1026 $post_types = "'" . implode( "', '", $post_types ) . "'"; 1025 $post_types = array( bbp_get_topic_post_type(), bbp_get_reply_post_type() ); 1026 $post_types = "'" . implode( "', '", $post_types ) . "'"; 1027 $status = bbp_get_public_status_id(); 1027 1028 1028 1029 // Loop through blogs and remove their posts … … 1033 1034 1034 1035 // Get topics and replies 1035 $posts = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_author = {$user_id} AND post_status = ' publish' AND post_type IN ({$post_types})" );1036 $posts = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_author = {$user_id} AND post_status = '{$status}' AND post_type IN ({$post_types})" ); 1036 1037 1037 1038 // Loop through posts and spam them … … 1097 1098 1098 1099 // Arm the torpedos 1099 global $wpdb , $bbp;1100 global $wpdb; 1100 1101 1101 1102 // Get the blog IDs of the user to mark as spam … … 1109 1110 $post_types = array( bbp_get_topic_post_type(), bbp_get_reply_post_type() ); 1110 1111 $post_types = "'" . implode( "', '", $post_types ) . "'"; 1112 $status = bbp_get_spam_status_id(); 1111 1113 1112 1114 // Loop through blogs and remove their posts … … 1117 1119 1118 1120 // Get topics and replies 1119 $posts = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_author = {$user_id} AND post_status = '{$ bbp->spam_status_id}' AND post_type IN ({$post_types})" );1121 $posts = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_author = {$user_id} AND post_status = '{$status}' AND post_type IN ({$post_types})" ); 1120 1122 1121 1123 // Loop through posts and spam them -
branches/plugin/bbp-includes/bbp-user-template.php
r3504 r3505 859 859 */ 860 860 function bbp_login_notices() { 861 global $bbp;862 861 863 862 // loggedout was passed … … 1251 1250 $defaults = array( 1252 1251 'post_type' => bbp_get_forum_post_type(), 1253 'post_status' => 'publish',1252 'post_status' => bbp_get_public_status_id(), 1254 1253 'numberposts' => -1, 1255 1254 'exclude' => $post__not_in -
branches/plugin/bbpress.php
r3496 r3505 32 32 class bbPress { 33 33 34 /** 35 * Note to Plugin and Theme authors: 36 * 37 * Do not directly reference the variables below in your code. Their names 38 * and locations in the bbPress class are subject to change at any time. 39 * 40 * Most of them have reference functions located in bbp-includes. The ones 41 * that don't can be accessed via their respective WordPress API's. 42 */ 43 34 44 /** Version ***************************************************************/ 35 45 … … 42 52 * @public string bbPress DB version 43 53 */ 44 public $db_version = '1 65';54 public $db_version = '175'; 45 55 46 56 /** Post types ************************************************************/ … … 347 357 348 358 // Status identifiers 349 $this->spam_status_id = apply_filters( 'bbp_spam_post_status', 'spam' ); 350 $this->closed_status_id = apply_filters( 'bbp_closed_post_status', 'closed' ); 351 $this->orphan_status_id = apply_filters( 'bbp_orphan_post_status', 'orphan' ); 352 $this->hidden_status_id = apply_filters( 'bbp_hidden_post_status', 'hidden' ); 353 $this->trash_status_id = 'trash'; 359 $this->spam_status_id = apply_filters( 'bbp_spam_post_status', 'spam' ); 360 $this->closed_status_id = apply_filters( 'bbp_closed_post_status', 'closed' ); 361 $this->orphan_status_id = apply_filters( 'bbp_orphan_post_status', 'orphan' ); 362 $this->public_status_id = apply_filters( 'bbp_public_post_status', 'publish' ); 363 $this->private_status_id = apply_filters( 'bbp_private_post_status', 'private' ); 364 $this->hidden_status_id = apply_filters( 'bbp_hidden_post_status', 'hidden' ); 365 $this->trash_status_id = apply_filters( 'bbp_trash_post_status', 'trash' ); 354 366 355 367 // Other identifiers
Note: See TracChangeset
for help on using the changeset viewer.