Ticket #2645: 2645.3.diff
| File 2645.3.diff, 45.0 KB (added by , 12 years ago) |
|---|
-
src/includes/admin/replies.php
158 158 'content' => 159 159 '<p>' . __( 'Hovering over a row in the replies list will display action links that allow you to manage your reply. You can perform the following actions:', 'bbpress' ) . '</p>' . 160 160 '<ul>' . 161 '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that reply. You can also reach that screen by clicking on the reply title.', 'bbpress' ) . '</li>' . 162 //'<li>' . __( '<strong>Quick Edit</strong> provides inline access to the metadata of your reply, allowing you to update reply details without leaving this screen.', 'bbpress' ) . '</li>' . 163 '<li>' . __( '<strong>Trash</strong> removes your reply from this list and places it in the trash, from which you can permanently delete it.', 'bbpress' ) . '</li>' . 164 '<li>' . __( '<strong>Spam</strong> removes your reply from this list and places it in the spam queue, from which you can permanently delete it.', 'bbpress' ) . '</li>' . 165 '<li>' . __( '<strong>Preview</strong> will show you what your draft reply will look like if you publish it. View will take you to your live site to view the reply. Which link is available depends on your reply’s status.', 'bbpress' ) . '</li>' . 161 '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that reply. You can also reach that screen by clicking on the reply title.', 'bbpress' ) . '</li>' . 162 //'<li>' . __( '<strong>Quick Edit</strong> provides inline access to the metadata of your reply, allowing you to update reply details without leaving this screen.', 'bbpress' ) . '</li>' . 163 '<li>' . __( '<strong>Trash</strong> removes your reply from this list and places it in the trash, from which you can permanently delete it.', 'bbpress' ) . '</li>' . 164 '<li>' . __( '<strong>Spam</strong> removes your reply from this list and places it in the spam queue, from which you can permanently delete it.', 'bbpress' ) . '</li>' . 165 '<li>' . __( '<strong>View</strong> will take you to your live site to view the reply.', 'bbpress' ) . '</li>' . 166 '<li>' . __( '<strong>Approve</strong> will change the status from pending to publish.', 'bbpress' ) . '</li>' . 166 167 '</ul>' 167 168 ) ); 168 169 … … 434 435 background-color: #faeaea; 435 436 } 436 437 438 .status-pending { 439 background-color: #fef7f1; 440 } 441 437 442 /*]]>*/ 438 443 </style> 439 444 … … 468 473 } 469 474 470 475 // Only proceed if GET is a reply toggle action 471 if ( bbp_is_get_request() && ! empty( $_GET['action'] ) && in_array( $_GET['action'], array( 'bbp_toggle_reply_spam' ) ) && !empty( $_GET['reply_id'] ) ) {476 if ( bbp_is_get_request() && ! empty( $_GET['action'] ) && in_array( $_GET['action'], array( 'bbp_toggle_reply_spam', 'bbp_toggle_reply_approve' ) ) && ! empty( $_GET['reply_id'] ) ) { 472 477 $action = $_GET['action']; // What action is taking place? 473 478 $reply_id = (int) $_GET['reply_id']; // What's the reply id? 474 479 $success = false; // Flag … … 486 491 } 487 492 488 493 switch ( $action ) { 494 case 'bbp_toggle_reply_approve' : 495 check_admin_referer( 'approve-reply_' . $reply_id ); 496 497 $is_approve = bbp_is_reply_pending( $reply_id ); 498 $message = $is_approve ? 'approved' : 'unapproved'; 499 $success = $is_approve ? bbp_approve_reply( $reply_id ) : bbp_unapprove_reply( $reply_id ); 500 501 break; 502 489 503 case 'bbp_toggle_reply_spam' : 490 504 check_admin_referer( 'spam-reply_' . $reply_id ); 491 505 … … 496 510 break; 497 511 } 498 512 499 $success = wp_update_post( $post_data );500 513 $message = array( 'bbp_reply_toggle_notice' => $message, 'reply_id' => $reply->ID ); 501 514 502 515 if ( false === $success || is_wp_error( $success ) ) { … … 536 549 } 537 550 538 551 // Only proceed if GET is a reply toggle action 539 if ( bbp_is_get_request() && ! empty( $_GET['bbp_reply_toggle_notice'] ) && in_array( $_GET['bbp_reply_toggle_notice'], array( 'spammed', 'unspammed' ) ) && !empty( $_GET['reply_id'] ) ) {552 if ( bbp_is_get_request() && ! empty( $_GET['bbp_reply_toggle_notice'] ) && in_array( $_GET['bbp_reply_toggle_notice'], array( 'spammed', 'unspammed', 'approved', 'unapproved' ) ) && ! empty( $_GET['reply_id'] ) ) { 540 553 $notice = $_GET['bbp_reply_toggle_notice']; // Which notice? 541 554 $reply_id = (int) $_GET['reply_id']; // What's the reply id? 542 555 $is_failure = !empty( $_GET['failed'] ) ? true : false; // Was that a failure? … … 566 579 ? sprintf( __( 'There was a problem unmarking the reply "%1$s" as spam.', 'bbpress' ), $reply_title ) 567 580 : sprintf( __( 'Reply "%1$s" successfully unmarked as spam.', 'bbpress' ), $reply_title ); 568 581 break; 582 583 case 'approved' : 584 $message = ( $is_failure === true ) 585 ? sprintf( __( 'There was a problem approving the reply "%1$s".', 'bbpress' ), $reply_title ) 586 : sprintf( __( 'Reply "%1$s" successfully approved.', 'bbpress' ), $reply_title ); 587 break; 588 589 case 'unapproved' : 590 $message = ( $is_failure === true ) 591 ? sprintf( __( 'There was a problem unapproving the reply "%1$s".', 'bbpress' ), $reply_title ) 592 : sprintf( __( 'Reply "%1$s" successfully unapproved.', 'bbpress' ), $reply_title ); 593 break; 569 594 } 570 595 571 596 // Do additional reply toggle notice filters (admin side) … … 767 792 unset( $actions['view'] ); 768 793 } 769 794 795 // Pending 796 // Show the 'approve' and 'view' link on pending posts only and 'unapprove' on published posts only 797 $approve_uri = wp_nonce_url( add_query_arg( array( 'reply_id' => $reply->ID, 'action' => 'bbp_toggle_reply_approve' ), remove_query_arg( array( 'bbp_reply_toggle_notice', 'reply_id', 'failed', 'super' ) ) ), 'approve-reply_' . $reply->ID ); 798 if ( bbp_is_reply_published( $reply->ID ) ) { 799 $actions['unapproved'] = '<a href="' . esc_url( $approve_uri ) . '" title="' . esc_attr__( 'Unapprove this reply', 'bbpress' ) . '">' . _x( 'Unapprove', 'Unapprove reply', 'bbpress' ) . '</a>'; 800 } elseif ( ! bbp_is_reply_private( $reply->ID ) ) { 801 $actions['approved'] = '<a href="' . esc_url( $approve_uri ) . '" title="' . esc_attr__( 'Approve this reply', 'bbpress' ) . '">' . _x( 'Approve', 'Approve reply', 'bbpress' ) . '</a>'; 802 } 803 770 804 // Only show the actions if the user is capable of viewing them 771 805 if ( current_user_can( 'moderate', $reply->ID ) ) { 772 806 if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_spam_status_id() ) ) ) { -
src/includes/admin/topics.php
157 157 'content' => 158 158 '<p>' . __( 'Hovering over a row in the topics list will display action links that allow you to manage your topic. You can perform the following actions:', 'bbpress' ) . '</p>' . 159 159 '<ul>' . 160 '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that topic. You can also reach that screen by clicking on the topic title.', 'bbpress' ) . '</li>' . 161 '<li>' . __( '<strong>Trash</strong> removes your topic from this list and places it in the trash, from which you can permanently delete it.', 'bbpress' ) . '</li>' . 162 '<li>' . __( '<strong>Spam</strong> removes your topic from this list and places it in the spam queue, from which you can permanently delete it.', 'bbpress' ) . '</li>' . 163 '<li>' . __( '<strong>Preview</strong> will show you what your draft topic will look like if you publish it. View will take you to your live site to view the topic. Which link is available depends on your topic’s status.', 'bbpress' ) . '</li>' . 164 '<li>' . __( '<strong>Close</strong> will mark the selected topic as ’closed’ and disable the option to post new replies to the topic.', 'bbpress' ) . '</li>' . 165 '<li>' . __( '<strong>Stick</strong> will keep the selected topic ’pinned’ to the top the parent forum topic list.', 'bbpress' ) . '</li>' . 166 '<li>' . __( '<strong>Stick <em>(to front)</em></strong> will keep the selected topic ’pinned’ to the top of ALL forums and be visable in any forums topics list.', 'bbpress' ) . '</li>' . 160 '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that topic. You can also reach that screen by clicking on the topic title.', 'bbpress' ) . '</li>' . 161 '<li>' . __( '<strong>Trash</strong> removes your topic from this list and places it in the trash, from which you can permanently delete it.', 'bbpress' ) . '</li>' . 162 '<li>' . __( '<strong>Spam</strong> removes your topic from this list and places it in the spam queue, from which you can permanently delete it.', 'bbpress' ) . '</li>' . 163 '<li>' . __( '<strong>View</strong> will take you to your live site to view the topic.', 'bbpress' ) . '</li>' . 164 '<li>' . __( '<strong>Approve</strong> will change the status from pending to publish.', 'bbpress' ) . '</li>' . 165 '<li>' . __( '<strong>Close</strong> will mark the selected topic as ’closed’ and disable the option to post new replies to the topic.', 'bbpress' ) . '</li>' . 166 '<li>' . __( '<strong>Stick</strong> will keep the selected topic ’pinned’ to the top the parent forum topic list.', 'bbpress' ) . '</li>' . 167 '<li>' . __( '<strong>Stick <em>(to front)</em></strong> will keep the selected topic ’pinned’ to the top of ALL forums and be visable in any forums topics list.', 'bbpress' ) . '</li>' . 167 168 '</ul>' 168 169 ) ); 169 170 … … 449 450 background-color: #faeaea; 450 451 } 451 452 453 .status-pending { 454 background-color: #fef7f1; 455 } 456 452 457 /*]]>*/ 453 458 </style> 454 459 … … 491 496 } 492 497 493 498 // Only proceed if GET is a topic toggle action 494 if ( bbp_is_get_request() && !empty( $_GET['action'] ) && in_array( $_GET['action'], array( 'bbp_toggle_topic_close', 'bbp_toggle_topic_stick', 'bbp_toggle_topic_spam' ) ) && !empty( $_GET['topic_id'] ) ) {499 if ( bbp_is_get_request() && !empty( $_GET['action'] ) && in_array( $_GET['action'], array( 'bbp_toggle_topic_close', 'bbp_toggle_topic_stick', 'bbp_toggle_topic_spam', 'bbp_toggle_topic_approve' ) ) && !empty( $_GET['topic_id'] ) ) { 495 500 $action = $_GET['action']; // What action is taking place? 496 501 $topic_id = (int) $_GET['topic_id']; // What's the topic id? 497 502 $success = false; // Flag 498 503 $post_data = array( 'ID' => $topic_id ); // Prelim array 499 $topic = bbp_get_topic( $topic_id ); 504 $topic = bbp_get_topic( $topic_id ); // Verify the topic id 500 505 501 506 // Bail if topic is missing 502 507 if ( empty( $topic ) ) { … … 509 514 } 510 515 511 516 switch ( $action ) { 517 case 'bbp_toggle_topic_approve' : 518 check_admin_referer( 'approve-topic_' . $topic_id ); 519 520 $is_approve = bbp_is_topic_pending( $topic_id ); 521 $message = ( true === $is_approve ) 522 ? 'approved' 523 : 'unapproved'; 524 $success = ( true === $is_approve ) 525 ? bbp_approve_topic( $topic_id ) 526 : bbp_unapprove_topic( $topic_id ); 527 528 break; 529 512 530 case 'bbp_toggle_topic_close' : 513 531 check_admin_referer( 'close-topic_' . $topic_id ); 514 532 … … 594 612 } 595 613 596 614 // Only proceed if GET is a topic toggle action 597 if ( bbp_is_get_request() && ! empty( $_GET['bbp_topic_toggle_notice'] ) && in_array( $_GET['bbp_topic_toggle_notice'], array( 'opened', 'closed', 'super_sticked', 'sticked', 'unsticked', 'spammed', 'unspammed' ) ) && !empty( $_GET['topic_id'] ) ) {615 if ( bbp_is_get_request() && ! empty( $_GET['bbp_topic_toggle_notice'] ) && in_array( $_GET['bbp_topic_toggle_notice'], array( 'opened', 'closed', 'super_sticked', 'sticked', 'unsticked', 'spammed', 'unspammed', 'approved', 'unapproved' ) ) && ! empty( $_GET['topic_id'] ) ) { 598 616 $notice = $_GET['bbp_topic_toggle_notice']; // Which notice? 599 617 $topic_id = (int) $_GET['topic_id']; // What's the topic id? 600 618 $is_failure = !empty( $_GET['failed'] ) ? true : false; // Was that a failure? 601 619 602 // Bai sif no topic_id or notice620 // Bail if no topic_id or notice 603 621 if ( empty( $notice ) || empty( $topic_id ) ) { 604 622 return; 605 623 } 606 624 607 // Bail if topic is missing625 // Get topic and bail if empty 608 626 $topic = bbp_get_topic( $topic_id ); 609 627 if ( empty( $topic ) ) { 610 628 return; … … 654 672 ? sprintf( __( 'There was a problem unmarking the topic "%1$s" as spam.', 'bbpress' ), $topic_title ) 655 673 : sprintf( __( 'Topic "%1$s" successfully unmarked as spam.', 'bbpress' ), $topic_title ); 656 674 break; 675 676 case 'approved' : 677 $message = ( $is_failure === true ) 678 ? sprintf( __( 'There was a problem approving the topic "%1$s".', 'bbpress' ), $topic_title ) 679 : sprintf( __( 'Topic "%1$s" successfully approved.', 'bbpress' ), $topic_title ); 680 break; 681 682 case 'unapproved' : 683 $message = ( $is_failure === true ) 684 ? sprintf( __( 'There was a problem unapproving the topic "%1$s".', 'bbpress' ), $topic_title ) 685 : sprintf( __( 'Topic "%1$s" successfully unapproved.', 'bbpress' ), $topic_title ); 686 break; 657 687 } 658 688 659 689 // Do additional topic toggle notice filters (admin side) … … 842 872 // Only show the actions if the user is capable of viewing them :) 843 873 if ( current_user_can( 'moderate', $topic->ID ) ) { 844 874 875 // Pending 876 // Show the 'approve' and 'view' link on pending posts only and 'unapprove' on published posts only 877 $approve_uri = wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_approve' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'approve-topic_' . $topic->ID ); 878 if ( bbp_is_topic_published( $topic->ID ) ) { 879 $actions['unapproved'] = '<a href="' . esc_url( $approve_uri ) . '" title="' . esc_attr__( 'Unapprove this topic', 'bbpress' ) . '">' . _x( 'Unapprove', 'Unapprove Topic', 'bbpress' ) . '</a>'; 880 } elseif ( ! bbp_is_topic_private( $topic->ID ) ) { 881 $actions['approved'] = '<a href="' . esc_url( $approve_uri ) . '" title="' . esc_attr__( 'Approve this topic', 'bbpress' ) . '">' . _x( 'Approve', 'Approve Topic', 'bbpress' ) . '</a>'; 882 $actions['view'] = '<a href="' . esc_url( bbp_get_topic_permalink( $topic->ID ) ) . '" title="' . esc_attr( sprintf( __( 'View “%s”', 'bbpress' ), bbp_get_topic_title( $topic->ID ) ) ) . '" rel="permalink">' . esc_html__( 'View', 'bbpress' ) . '</a>'; 883 } 884 845 885 // Close 846 886 // Show the 'close' and 'open' link on published and closed posts only 847 887 if ( in_array( $topic->post_status, array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ) ) { … … 853 893 } 854 894 } 855 895 856 // Dont show sticky if topic links is spam or trash857 if ( ! bbp_is_topic_spam( $topic->ID ) && !bbp_is_topic_trash( $topic->ID ) ) {896 // Dont show sticky if topic links is spam, trash or pending 897 if ( ! bbp_is_topic_spam( $topic->ID ) && ! bbp_is_topic_trash( $topic->ID ) && ! bbp_is_topic_pending( $topic->ID ) ) { 858 898 859 899 // Sticky 860 900 $stick_uri = wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_stick' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'stick-topic_' . $topic->ID ); -
src/includes/core/actions.php
155 155 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_success' ); 156 156 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_is_super_admin', 2 ); 157 157 158 // Before Delete/Trash/Untrash Topic158 // Before Delete/Trash/Untrash Forum 159 159 add_action( 'wp_trash_post', 'bbp_trash_forum' ); 160 160 add_action( 'trash_post', 'bbp_trash_forum' ); 161 161 add_action( 'untrash_post', 'bbp_untrash_forum' ); 162 162 add_action( 'delete_post', 'bbp_delete_forum' ); 163 163 164 // After Deleted/Trashed/Untrashed Topic164 // After Deleted/Trashed/Untrashed Forum 165 165 add_action( 'trashed_post', 'bbp_trashed_forum' ); 166 166 add_action( 'untrashed_post', 'bbp_untrashed_forum' ); 167 167 add_action( 'deleted_post', 'bbp_deleted_forum' ); … … 242 242 add_action( 'bbp_deleted_topic', 'bbp_update_topic_walker' ); 243 243 add_action( 'bbp_spammed_topic', 'bbp_update_topic_walker' ); 244 244 add_action( 'bbp_unspammed_topic', 'bbp_update_topic_walker' ); 245 add_action( 'bbp_approve_topic', 'bbp_update_topic_walker' ); 246 add_action( 'bbp_unapprove_topic', 'bbp_update_topic_walker' ); 245 247 246 248 // Update reply branch 247 249 add_action( 'bbp_trashed_reply', 'bbp_update_reply_walker' ); … … 249 251 add_action( 'bbp_deleted_reply', 'bbp_update_reply_walker' ); 250 252 add_action( 'bbp_spammed_reply', 'bbp_update_reply_walker' ); 251 253 add_action( 'bbp_unspammed_reply', 'bbp_update_reply_walker' ); 254 add_action( 'bbp_approve_reply', 'bbp_update_reply_walker' ); 255 add_action( 'bbp_unapprove_reply', 'bbp_update_reply_walker' ); 252 256 253 257 // Users topic & reply counts 254 258 add_action( 'bbp_new_topic', 'bbp_increase_user_topic_count' ); … … 267 271 add_action( 'bbp_untrash_topic', 'bbp_untrash_topic_replies' ); 268 272 add_action( 'bbp_delete_topic', 'bbp_delete_topic_replies' ); 269 273 add_action( 'bbp_spam_topic', 'bbp_spam_topic_replies' ); 270 add_action( 'bbp_unspam_topic', 'bbp_unspam_topic_replies' );274 add_action( 'bbp_unspam_topic', 'bbp_unspam_topic_replies' ); 271 275 272 276 // User status 273 277 // @todo make these sub-actions … … 332 336 // Maybe convert the users password 333 337 add_action( 'bbp_login_form_login', 'bbp_user_maybe_convert_pass' ); 334 338 335 add_action( 'bbp_activation', 'bbp_add_activation_redirect' ); 336 No newline at end of file 339 add_action( 'bbp_activation', 'bbp_add_activation_redirect' ); -
src/includes/forums/functions.php
949 949 // First, delete everything. 950 950 delete_option( '_bbp_private_forums' ); 951 951 delete_option( '_bbp_hidden_forums' ); 952 952 953 953 /** 954 954 * Don't search for both private/hidden statuses. Since 'pre_get_posts' is an 955 * action, it's not removed by suppress_filters. We need to make sure that 955 * action, it's not removed by suppress_filters. We need to make sure that 956 956 * we're only searching for the supplied post_status. 957 957 * 958 958 * @see https://bbpress.trac.wordpress.org/ticket/2512 … … 974 974 'post_status' => bbp_get_hidden_status_id(), 975 975 'fields' => 'ids' 976 976 ) ); 977 977 978 978 // Enable forum visibilty normalization 979 979 add_action( 'pre_get_posts', 'bbp_pre_get_posts_normalize_forum_visibility', 4 ); 980 980 … … 1096 1096 * @param int $forum_id Optional. Forum id. 1097 1097 * @param int $difference Optional. Default 1 1098 1098 * @uses bbp_get_forum_id() To get the forum id 1099 * @uses bbp_get_forum_topic_count_hidden To get the forum's hidden topic count 1099 1100 * @uses update_post_meta() To update the forum's topic count meta 1100 1101 * @uses apply_filters() Calls 'bbp_bump_forum_topic_count_hidden' with the 1101 1102 * topic count, forum id, and difference … … 1462 1463 } 1463 1464 1464 1465 /** 1465 * Adjust the total hidden topic count of a forum (hidden includes trashed and spammed topics) 1466 * Adjust the total hidden topic count of a forum (hidden includes trashed, 1467 * spammed and pending topics) 1466 1468 * 1467 1469 * @since bbPress (r2888) 1468 1470 * … … 1472 1474 * @uses bbp_get_topic_id() To get the topic id 1473 1475 * @uses bbp_get_topic_forum_id() To get the topic forum id 1474 1476 * @uses bbp_get_forum_id() To get the forum id 1477 * @uses bbp_get_trash_status_id() To get the trash status id 1478 * @uses bbp_get_spam_status_id() To get the spam status id 1479 * @uses bbp_get_pending_status_id() To get the pending status id 1475 1480 * @uses wpdb::prepare() To prepare our sql query 1476 * @uses wpdb::get_ col() To execute our query and get the columnback1481 * @uses wpdb::get_var() To execute our query and get the var back 1477 1482 * @uses update_post_meta() To update the forum hidden topic count meta 1478 1483 * @uses apply_filters() Calls 'bbp_update_forum_topic_count_hidden' with the 1479 1484 * hidden topic count and forum id … … 1493 1498 } 1494 1499 1495 1500 // Can't update what isn't there 1496 if ( ! empty( $forum_id ) ) {1501 if ( ! empty( $forum_id ) ) { 1497 1502 1498 1503 // Get topics of forum 1499 1504 if ( empty( $topic_count ) ) { 1500 $post_status = "'" . implode( "','", array( bbp_get_trash_status_id(), bbp_get_spam_status_id() ) ) . "'";1505 $post_status = "'" . implode( "','", array( bbp_get_trash_status_id(), bbp_get_spam_status_id(), bbp_get_pending_status_id() ) ) . "'"; 1501 1506 $topic_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s';", $forum_id, bbp_get_topic_post_type() ) ); 1502 1507 } 1503 1508 -
src/includes/forums/template.php
1427 1427 } 1428 1428 1429 1429 /** 1430 * Output total hidden topic count of a forum (hidden includes trashed and1431 * spammedtopics)1430 * Output total hidden topic count of a forum (hidden includes trashed, spammed, 1431 * and pending topics) 1432 1432 * 1433 1433 * @since bbPress (r2883) 1434 1434 * … … 1440 1440 echo bbp_get_forum_topic_count_hidden( $forum_id, $integer ); 1441 1441 } 1442 1442 /** 1443 * Return total hidden topic count of a forum (hidden includes trashed 1444 * and spammedtopics)1443 * Return total hidden topic count of a forum (hidden includes trashed, 1444 * spammed and pending topics) 1445 1445 * 1446 1446 * @since bbPress (r2883) 1447 1447 * … … 2245 2245 2246 2246 return apply_filters( 'bbp_get_form_forum_visibility', esc_attr( $forum_visibility ) ); 2247 2247 } 2248 2248 2249 2249 /** 2250 2250 * Output checked value of forum subscription 2251 2251 * -
src/includes/replies/functions.php
1163 1163 * @return array 1164 1164 */ 1165 1165 function bbp_get_reply_ancestors( $reply_id = 0 ) { 1166 1166 1167 1167 // Validation 1168 1168 $reply_id = bbp_get_reply_id( $reply_id ); 1169 1169 $ancestors = array(); … … 1469 1469 } 1470 1470 1471 1471 // Remove reply_to from moved reply 1472 delete_post_meta( $move_reply->ID, '_bbp_reply_to' ); 1472 delete_post_meta( $move_reply->ID, '_bbp_reply_to' ); 1473 1473 1474 1474 // It is a new topic and we need to set some default metas to make 1475 1475 // the topic display in bbp_has_topics() list … … 1582 1582 // Setup possible get actions 1583 1583 $possible_actions = array( 1584 1584 'bbp_toggle_reply_spam', 1585 'bbp_toggle_reply_trash' 1585 'bbp_toggle_reply_trash', 1586 'bbp_toggle_reply_approve' 1586 1587 ); 1587 1588 1588 1589 // Bail if actions aren't meant for this function … … 1611 1612 // What action are we trying to perform? 1612 1613 switch ( $action ) { 1613 1614 1615 // Toggle approve 1616 case 'bbp_toggle_reply_approve' : 1617 check_ajax_referer( 'approve-reply_' . $reply_id ); 1618 1619 $is_approve = bbp_is_reply_pending( $reply_id ); 1620 $success = $is_approve ? bbp_approve_reply( $reply_id ) : bbp_unapprove_reply( $reply_id ); 1621 $failure = $is_approve ? __( '<strong>ERROR</strong>: There was a problem approving the reply!', 'bbpress' ) : __( '<strong>ERROR</strong>: There was a problem unapproving thereply!', 'bbpress' ); 1622 $view_all = !$is_approve; 1623 1624 break; 1625 1614 1626 // Toggle spam 1615 1627 case 'bbp_toggle_reply_spam' : 1616 1628 check_ajax_referer( 'spam-reply_' . $reply_id ); … … 1814 1826 return $reply_id; 1815 1827 } 1816 1828 1829 /** 1830 * Approves a reply 1831 * 1832 * @since bbPress (rXXXX) 1833 * 1834 * @param int $reply_id Reply id 1835 * @uses bbp_get_reply() To get the reply 1836 * @uses do_action() Calls 'bbp_approve_reply' with the reply id 1837 /* @uses add_post_meta() To add the previous status to a meta 1838 /* @uses delete_post_meta() To delete the previous status meta 1839 * @uses wp_update_post() To update the reply with the new status 1840 * @uses do_action() Calls 'bbp_approved_reply' with the reply id 1841 * @return mixed False or {@link WP_Error} on failure, reply id on success 1842 */ 1843 function bbp_approve_reply( $reply_id = 0 ) { 1844 1845 // Get reply 1846 $reply = bbp_get_reply( $reply_id ); 1847 if ( empty( $reply ) ) { 1848 return $reply; 1849 } 1850 1851 // Bail if already approved 1852 if ( bbp_get_pending_status_id() !== $reply->post_status ) { 1853 return false; 1854 } 1855 1856 // Execute pre pending code 1857 do_action( 'bbp_approve_reply', $reply_id ); 1858 1859 // Set publish status 1860 $reply->post_status = bbp_get_public_status_id(); 1861 1862 // No revisions 1863 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 1864 1865 // Update reply 1866 $reply_id = wp_update_post( $reply ); 1867 1868 // Execute post pending code 1869 do_action( 'bbp_approved_reply', $reply_id ); 1870 1871 // Return reply_id 1872 return $reply_id; 1873 } 1874 1875 /** 1876 * Unapproves a reply 1877 * 1878 * @since bbPress (rXXXX) 1879 * 1880 * @param int $reply_id Reply id 1881 * @uses bbp_get_reply() To get the reply 1882 * @uses do_action() Calls 'bbp_unapprove_reply' with the reply id 1883 /* @uses get_post_meta() To get the previous status 1884 /* @uses delete_post_meta() To delete the previous status meta 1885 * @uses wp_update_post() To update the reply with the new status 1886 * @uses do_action() Calls 'bbp_unapproved_reply' with the reply id 1887 * @return mixed False or {@link WP_Error} on failure, reply id on success 1888 */ 1889 function bbp_unapprove_reply( $reply_id = 0 ) { 1890 1891 // Get reply 1892 $reply = bbp_get_reply( $reply_id ); 1893 if ( empty( $reply ) ) { 1894 return $reply; 1895 } 1896 1897 // Bail if already pending 1898 if ( bbp_get_pending_status_id() === $reply->post_status ) { 1899 return false; 1900 } 1901 1902 // Execute pre open code 1903 do_action( 'bbp_unapprove_reply', $reply_id ); 1904 1905 // Set pending status 1906 $reply->post_status = bbp_get_pending_status_id(); 1907 1908 // No revisions 1909 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 1910 1911 // Update reply 1912 $reply_id = wp_update_post( $reply ); 1913 1914 // Execute post open code 1915 do_action( 'bbp_unapproved_reply', $reply_id ); 1916 1917 // Return reply_id 1918 return $reply_id; 1919 } 1920 1817 1921 /** Before Delete/Trash/Untrash ***********************************************/ 1818 1922 1819 1923 /** … … 2334 2438 2335 2439 /** 2336 2440 * Validate a `reply_to` field for hierarchical replies 2337 * 2441 * 2338 2442 * Checks for 2 scenarios: 2339 2443 * -- The reply to ID is actually a reply 2340 2444 * -- The reply to ID does not match the current reply -
src/includes/replies/template.php
150 150 bbp_get_public_status_id(), 151 151 bbp_get_closed_status_id(), 152 152 bbp_get_spam_status_id(), 153 bbp_get_trash_status_id() 153 bbp_get_trash_status_id(), 154 bbp_get_pending_status_id() 154 155 ); 155 156 156 157 // Add support for private status … … 952 953 } 953 954 954 955 /** 956 * Is the reply pending? 957 * 958 * @since bbPress (rXXXX) 959 * 960 * @param int $reply_id Optional. Topic id 961 * @uses bbp_get_reply_id() To get the reply id 962 * @uses bbp_get_reply_status() To get the reply status 963 * @uses apply_filters() Calls 'bbp_is_reply_pending' with the reply id 964 * @return bool True if pending, false if not. 965 */ 966 function bbp_is_reply_pending( $reply_id = 0 ) { 967 $reply_status = bbp_get_reply_status( bbp_get_reply_id( $reply_id ) ) === bbp_get_pending_status_id(); 968 return (bool) apply_filters( 'bbp_is_reply_pending', (bool) $reply_status, $reply_id ); 969 } 970 971 /** 972 * Is the reply private? 973 * 974 * @since bbPress (rXXXX) 975 * 976 * @param int $reply_id Optional. Topic id 977 * @uses bbp_get_reply_id() To get the reply id 978 * @uses bbp_get_reply_status() To get the reply status 979 * @uses apply_filters() Calls 'bbp_is_reply_private' with the reply id 980 * @return bool True if private, false if not. 981 */ 982 function bbp_is_reply_private( $reply_id = 0 ) { 983 $reply_status = bbp_get_reply_status( bbp_get_reply_id( $reply_id ) ) === bbp_get_private_status_id(); 984 return (bool) apply_filters( 'bbp_is_reply_private', (bool) $reply_status, $reply_id ); 985 } 986 987 /** 955 988 * Is the reply by an anonymous user? 956 989 * 957 990 * @since bbPress (r2753) … … 1853 1886 // If no links were passed, default to the standard 1854 1887 if ( empty( $r['links'] ) ) { 1855 1888 $r['links'] = apply_filters( 'bbp_reply_admin_links', array( 1856 'edit' => bbp_get_reply_edit_link ( $r ), 1857 'move' => bbp_get_reply_move_link ( $r ), 1858 'split' => bbp_get_topic_split_link( $r ), 1859 'trash' => bbp_get_reply_trash_link( $r ), 1860 'spam' => bbp_get_reply_spam_link ( $r ), 1861 'reply' => bbp_get_reply_to_link ( $r ) 1889 'edit' => bbp_get_reply_edit_link ( $r ), 1890 'move' => bbp_get_reply_move_link ( $r ), 1891 'split' => bbp_get_topic_split_link ( $r ), 1892 'trash' => bbp_get_reply_trash_link ( $r ), 1893 'spam' => bbp_get_reply_spam_link ( $r ), 1894 'approve' => bbp_get_reply_approve_link( $r ), 1895 'reply' => bbp_get_reply_to_link ( $r ) 1862 1896 ), $r['id'] ); 1863 1897 } 1864 1898 1865 1899 // See if links need to be unset 1866 1900 $reply_status = bbp_get_reply_status( $r['id'] ); 1867 if ( in_array( $reply_status, array( bbp_get_spam_status_id(), bbp_get_trash_status_id() ) ) ) {1901 if ( in_array( $reply_status, array( bbp_get_spam_status_id(), bbp_get_trash_status_id(), bbp_get_pending_status_id() ) ) ) { 1868 1902 1869 1903 // Spam link shouldn't be visible on trashed topics 1870 1904 if ( bbp_get_trash_status_id() === $reply_status ) { … … 2273 2307 } 2274 2308 2275 2309 /** 2310 * Output the approve link of the reply 2311 * 2312 * @since bbPress (rXXXX) 2313 * 2314 * @param mixed $args See {@link bbp_get_reply_approve_link()} 2315 * @uses bbp_get_reply_approve_link() To get the reply approve link 2316 */ 2317 function bbp_reply_approve_link( $args = '' ) { 2318 echo bbp_get_reply_approve_link( $args ); 2319 } 2320 2321 /** 2322 * Return the approve link of the reply 2323 * 2324 * @since bbPress (rXXXX) 2325 * 2326 * @param mixed $args This function supports these args: 2327 * - id: Optional. Reply id 2328 * - link_before: Before the link 2329 * - link_after: After the link 2330 * - sep: Separator between links 2331 * - approve_text: Approve text 2332 * - unapprove_text: Unapprove text 2333 * @uses bbp_get_reply_id() To get the reply id 2334 * @uses bbp_get_reply() To get the reply 2335 * @uses current_user_can() To check if the current user can approve the reply 2336 * @uses bbp_is_reply_pending() To check if the reply is pending 2337 * @uses add_query_arg() To add custom args to the url 2338 * @uses wp_nonce_url() To nonce the url 2339 * @uses esc_url() To escape the url 2340 * @uses apply_filters() Calls 'bbp_get_reply_approve_link' with the link 2341 * and args 2342 * @return string Reply approve link 2343 */ 2344 function bbp_get_reply_approve_link( $args = '' ) { 2345 2346 // Parse arguments against default values 2347 $r = bbp_parse_args( $args, array( 2348 'id' => 0, 2349 'link_before' => '', 2350 'link_after' => '', 2351 'sep' => ' | ', 2352 'approve_text' => _x( 'Approve', 'Pending Status', 'bbpress' ), 2353 'unapprove_text' => _x( 'Unapprove', 'Pending Status', 'bbpress' ) 2354 ), 'get_reply_approve_link' ); 2355 2356 $reply = bbp_get_reply( bbp_get_reply_id( (int) $r['id'] ) ); 2357 2358 if ( empty( $reply ) || !current_user_can( 'moderate', $reply->ID ) ) 2359 return; 2360 2361 $display = bbp_is_reply_pending( $reply->ID ) ? $r['approve_text'] : $r['unapprove_text']; 2362 $uri = add_query_arg( array( 'action' => 'bbp_toggle_reply_approve', 'reply_id' => $reply->ID ) ); 2363 $uri = wp_nonce_url( $uri, 'approve-reply_' . $reply->ID ); 2364 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-reply-approve-link">' . $display . '</a>' . $r['link_after']; 2365 2366 return apply_filters( 'bbp_get_reply_approve_link', $retval, $r ); 2367 } 2368 2369 /** 2276 2370 * Output the row class of a reply 2277 2371 * 2278 2372 * @since bbPress (r2678) -
src/includes/search/template.php
64 64 bbp_get_public_status_id(), 65 65 bbp_get_closed_status_id(), 66 66 bbp_get_spam_status_id(), 67 bbp_get_trash_status_id() 67 bbp_get_trash_status_id(), 68 bbp_get_pending_status_id() 68 69 ); 69 70 70 71 // Add support for private status … … 141 142 'prev_text' => is_rtl() ? '→' : '←', 142 143 'next_text' => is_rtl() ? '←' : '→', 143 144 'mid_size' => 1, 144 'add_args' => $add_args, 145 'add_args' => $add_args, 145 146 ) ) 146 147 ); 147 148 -
src/includes/topics/functions.php
2112 2112 'bbp_toggle_topic_close', 2113 2113 'bbp_toggle_topic_stick', 2114 2114 'bbp_toggle_topic_spam', 2115 'bbp_toggle_topic_trash' 2115 'bbp_toggle_topic_trash', 2116 'bbp_toggle_topic_approve' 2116 2117 ); 2117 2118 2118 2119 // Bail if actions aren't meant for this function … … 2142 2143 // What action are we trying to perform? 2143 2144 switch ( $action ) { 2144 2145 2146 // Toggle approve/unapprove 2147 case 'bbp_toggle_topic_approve' : 2148 check_ajax_referer( 'approve-topic_' . $topic_id ); 2149 2150 $is_pending = bbp_is_topic_pending( $topic_id ); 2151 $success = true === $is_pending ? bbp_approve_topic( $topic_id ) : bbp_unapprove_topic( $topic_id ); 2152 $failure = true === $is_pending ? __( '<strong>ERROR</strong>: There was a problem approving the topic.', 'bbpress' ) : __( '<strong>ERROR</strong>: There was a problem unapproving the topic.', 'bbpress' ); 2153 2154 break; 2155 2145 2156 // Toggle open/close 2146 2157 case 'bbp_toggle_topic_close' : 2147 2158 check_ajax_referer( 'close-topic_' . $topic_id ); … … 2354 2365 * @param int $topic_id Optional. Forum id. 2355 2366 * @param int $difference Optional. Default 1 2356 2367 * @uses bbp_get_topic_id() To get the topic id 2368 * @uses bbp_get_topic_reply_count_hidden To get the topic's hidden reply count 2357 2369 * @uses update_post_meta() To update the topic's reply count meta 2358 2370 * @uses apply_filters() Calls 'bbp_bump_topic_reply_count_hidden' with the 2359 2371 * reply count, topic id, and difference … … 2465 2477 } 2466 2478 2467 2479 /** 2468 * Adjust the total hidden reply count of a topic (hidden includes trashed and spammed replies) 2480 * Adjust the total hidden reply count of a topic (hidden includes trashed, 2481 * spammed and pending replies) 2469 2482 * 2470 2483 * @since bbPress (r2740) 2471 2484 * … … 2474 2487 * @uses bbp_is_reply() To check if the passed topic id is a reply 2475 2488 * @uses bbp_get_reply_topic_id() To get the reply topic id 2476 2489 * @uses bbp_get_topic_id() To get the topic id 2490 * @uses bbp_get_trash_status_id() To get the trash status id 2491 * @uses bbp_get_spam_status_id() To get the spam status id 2492 * @uses bbp_get_pending_status_id() To get the pending status id 2477 2493 * @uses bbp_get_reply_post_type() To get the reply post type 2478 2494 * @uses wpdb::prepare() To prepare our sql query 2479 2495 * @uses wpdb::get_var() To execute our query and get the var back … … 2494 2510 2495 2511 // Get replies of topic 2496 2512 if ( empty( $reply_count ) ) { 2497 $post_status = "'" . implode( "','", array( bbp_get_trash_status_id(), bbp_get_spam_status_id() ) ) . "'";2513 $post_status = "'" . implode( "','", array( bbp_get_trash_status_id(), bbp_get_spam_status_id(), bbp_get_pending_status_id() ) ) . "'"; 2498 2514 $reply_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s';", $topic_id, bbp_get_reply_post_type() ) ); 2499 2515 } 2500 2516 … … 3174 3190 } 3175 3191 3176 3192 /** 3193 * Approves a topic 3194 * 3195 * @since bbPress (rXXXX) 3196 * 3197 * @param int $topic_id Topic id 3198 * @uses bbp_get_topic() To get the topic 3199 * @uses do_action() Calls 'bbp_approve_topic' with the topic id 3200 /* @uses add_post_meta() To add the previous status to a meta 3201 /* @uses delete_post_meta() To delete the previous status meta 3202 * @uses wp_update_post() To update the topic with the new status 3203 * @uses do_action() Calls 'bbp_approved_topic' with the topic id 3204 * @return mixed False or {@link WP_Error} on failure, topic id on success 3205 */ 3206 function bbp_approve_topic( $topic_id = 0 ) { 3207 3208 // Get topic 3209 $topic = bbp_get_topic( $topic_id ); 3210 if ( empty( $topic ) ) { 3211 return $topic; 3212 } 3213 3214 // Bail if already approved 3215 if ( bbp_get_pending_status_id() !== $topic->post_status ) { 3216 return false; 3217 } 3218 3219 // Execute pre pending code 3220 do_action( 'bbp_approve_topic', $topic_id ); 3221 3222 // Set publish status 3223 $topic->post_status = bbp_get_public_status_id(); 3224 3225 // No revisions 3226 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 3227 3228 // Update topic 3229 $topic_id = wp_update_post( $topic ); 3230 3231 // Execute post pending code 3232 do_action( 'bbp_approved_topic', $topic_id ); 3233 3234 // Return topic_id 3235 return $topic_id; 3236 } 3237 3238 /** 3239 * Unapproves a topic 3240 * 3241 * @since bbPress (rXXXX) 3242 * 3243 * @param int $topic_id Topic id 3244 * @uses bbp_get_topic() To get the topic 3245 * @uses do_action() Calls 'bbp_unapprove_topic' with the topic id 3246 /* @uses get_post_meta() To get the previous status 3247 /* @uses delete_post_meta() To delete the previous status meta 3248 * @uses wp_update_post() To update the topic with the new status 3249 * @uses do_action() Calls 'bbp_unapproved_topic' with the topic id 3250 * @return mixed False or {@link WP_Error} on failure, topic id on success 3251 */ 3252 function bbp_unapprove_topic( $topic_id = 0 ) { 3253 3254 // Get topic 3255 $topic = bbp_get_topic( $topic_id ); 3256 if ( empty( $topic ) ) { 3257 return $topic; 3258 } 3259 3260 // Bail if already pending 3261 if ( bbp_get_pending_status_id() === $topic->post_status ) { 3262 return false; 3263 } 3264 3265 // Execute pre open code 3266 do_action( 'bbp_unapprove_topic', $topic_id ); 3267 3268 // Set pending status 3269 $topic->post_status = bbp_get_pending_status_id(); 3270 3271 // No revisions 3272 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 3273 3274 // Update topic 3275 $topic_id = wp_update_post( $topic ); 3276 3277 // Execute post open code 3278 do_action( 'bbp_unapproved_topic', $topic_id ); 3279 3280 // Return topic_id 3281 return $topic_id; 3282 } 3283 3284 /** 3177 3285 * Unsticks a topic both from front and it's forum 3178 3286 * 3179 3287 * @since bbPress (r2754) -
src/includes/topics/template.php
171 171 bbp_get_public_status_id(), 172 172 bbp_get_closed_status_id(), 173 173 bbp_get_spam_status_id(), 174 bbp_get_trash_status_id() 174 bbp_get_trash_status_id(), 175 bbp_get_pending_status_id() 175 176 ); 176 177 177 178 // Add support for private status … … 1226 1227 } 1227 1228 1228 1229 /** 1230 * Is the topic pending? 1231 * 1232 * @since bbPress (rXXXX) 1233 * 1234 * @param int $topic_id Optional. Topic id 1235 * @uses bbp_get_topic_id() To get the topic id 1236 * @uses bbp_get_topic_status() To get the topic status 1237 * @uses apply_filters() Calls 'bbp_is_topic_pending' with the topic id 1238 * @return bool True if pending, false if not. 1239 */ 1240 function bbp_is_topic_pending( $topic_id = 0 ) { 1241 $topic_status = bbp_get_topic_status( bbp_get_topic_id( $topic_id ) ) === bbp_get_pending_status_id(); 1242 return (bool) apply_filters( 'bbp_is_topic_pending', (bool) $topic_status, $topic_id ); 1243 } 1244 1245 /** 1246 * Is the topic private? 1247 * 1248 * @since bbPress (rXXXX) 1249 * 1250 * @param int $topic_id Optional. Topic id 1251 * @uses bbp_get_topic_id() To get the topic id 1252 * @uses bbp_get_topic_status() To get the topic status 1253 * @uses apply_filters() Calls 'bbp_is_topic_private' with the topic id 1254 * @return bool True if private, false if not. 1255 */ 1256 function bbp_is_topic_private( $topic_id = 0 ) { 1257 $topic_status = bbp_get_topic_status( bbp_get_topic_id( $topic_id ) ) === bbp_get_private_status_id(); 1258 return (bool) apply_filters( 'bbp_is_topic_private', (bool) $topic_status, $topic_id ); 1259 } 1260 1261 /** 1229 1262 * Is the posted by an anonymous user? 1230 1263 * 1231 1264 * @since bbPress (r2753) … … 2441 2474 2442 2475 if ( empty( $r['links'] ) ) { 2443 2476 $r['links'] = apply_filters( 'bbp_topic_admin_links', array( 2444 'edit' => bbp_get_topic_edit_link ( $r ), 2445 'close' => bbp_get_topic_close_link( $r ), 2446 'stick' => bbp_get_topic_stick_link( $r ), 2447 'merge' => bbp_get_topic_merge_link( $r ), 2448 'trash' => bbp_get_topic_trash_link( $r ), 2449 'spam' => bbp_get_topic_spam_link ( $r ), 2450 'reply' => bbp_get_topic_reply_link( $r ) 2477 'edit' => bbp_get_topic_edit_link ( $r ), 2478 'close' => bbp_get_topic_close_link ( $r ), 2479 'stick' => bbp_get_topic_stick_link ( $r ), 2480 'merge' => bbp_get_topic_merge_link ( $r ), 2481 'trash' => bbp_get_topic_trash_link ( $r ), 2482 'spam' => bbp_get_topic_spam_link ( $r ), 2483 'approve' => bbp_get_topic_approve_link( $r ), 2484 'reply' => bbp_get_topic_reply_link ( $r ) 2451 2485 ), $r['id'] ); 2452 2486 } 2453 2487 2454 2488 // See if links need to be unset 2455 2489 $topic_status = bbp_get_topic_status( $r['id'] ); 2456 if ( in_array( $topic_status, array( bbp_get_spam_status_id(), bbp_get_trash_status_id() ) ) ) {2490 if ( in_array( $topic_status, array( bbp_get_spam_status_id(), bbp_get_trash_status_id(), bbp_get_pending_status_id() ) ) ) { 2457 2491 2458 // Close link shouldn't be visible on trashed/spammed topics2492 // Close link shouldn't be visible on trashed/spammed/pending topics 2459 2493 unset( $r['links']['close'] ); 2460 2494 2461 2495 // Spam link shouldn't be visible on trashed topics … … 2728 2762 } 2729 2763 2730 2764 /** 2765 * Output the approve link of the topic 2766 * 2767 * @since bbPress (rXXXX) 2768 * 2769 * @param mixed $args See {@link bbp_get_topic_approve_link()} 2770 * @uses bbp_get_topic_approve_link() To get the topic approve link 2771 */ 2772 function bbp_topic_approve_link( $args = '' ) { 2773 echo bbp_get_topic_approve_link( $args ); 2774 } 2775 2776 /** 2777 * Return the approve link of the topic 2778 * 2779 * @since bbPress (rXXXX) 2780 * 2781 * @param mixed $args This function supports these args: 2782 * - id: Optional. Topic id 2783 * - link_before: Before the link 2784 * - link_after: After the link 2785 * - sep: Separator between links 2786 * - approve_text: Approve text 2787 * - unapprove_text: Unapprove text 2788 * @uses bbp_get_topic_id() To get the topic id 2789 * @uses bbp_get_topic() To get the topic 2790 * @uses current_user_can() To check if the current user can approve the topic 2791 * @uses bbp_is_topic_pending() To check if the topic is pending 2792 * @uses add_query_arg() To add custom args to the url 2793 * @uses wp_nonce_url() To nonce the url 2794 * @uses esc_url() To escape the url 2795 * @uses apply_filters() Calls 'bbp_get_topic_approve_link' with the link 2796 * and args 2797 * @return string Topic approve link 2798 */ 2799 function bbp_get_topic_approve_link( $args = '' ) { 2800 2801 // Parse arguments against default values 2802 $r = bbp_parse_args( $args, array( 2803 'id' => 0, 2804 'link_before' => '', 2805 'link_after' => '', 2806 'sep' => ' | ', 2807 'approve_text' => _x( 'Approve', 'Pending Status', 'bbpress' ), 2808 'unapprove_text' => _x( 'Unapprove', 'Pending Status', 'bbpress' ) 2809 ), 'get_topic_approve_link' ); 2810 2811 $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) ); 2812 2813 if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) ) 2814 return; 2815 2816 $display = bbp_is_topic_pending( $topic->ID ) ? $r['approve_text'] : $r['unapprove_text']; 2817 $uri = add_query_arg( array( 'action' => 'bbp_toggle_topic_approve', 'topic_id' => $topic->ID ) ); 2818 $uri = wp_nonce_url( $uri, 'approve-topic_' . $topic->ID ); 2819 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-approve-link">' . $display . '</a>' . $r['link_after']; 2820 2821 return apply_filters( 'bbp_get_topic_approve_link', $retval, $r ); 2822 } 2823 2824 /** 2731 2825 * Output the stick link of the topic 2732 2826 * 2733 2827 * @since bbPress (r2754) -
src/templates/default/css/bbpress.css
54 54 background-color: #fdd; 55 55 } 56 56 57 #bbpress-forums .status-pending.even, 58 #bbpress-forums .status-pending.odd, 59 #bbpress-forums ul.status-pending a { 60 background-color: #fef7f1; 61 } 62 57 63 #bbpress-forums ul.status-closed, 58 64 #bbpress-forums ul.status-closed a { 59 65 color: #ccc;
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)