Ticket #2645: 2645.6.diff
File 2645.6.diff, 12.7 KB (added by , 10 years ago) |
---|
-
src/includes/admin/replies.php
803 803 $actions['approved'] = '<a href="' . esc_url( $approve_uri ) . '" title="' . esc_attr__( 'Approve this reply', 'bbpress' ) . '">' . _x( 'Approve', 'Approve reply', 'bbpress' ) . '</a>'; 804 804 } 805 805 806 if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_spam_status_id() ) ) ) { 806 // Show the 'spam' link on published and pending replies and 'not spam' on spammed replies 807 if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_pending_status_id(), bbp_get_spam_status_id() ) ) ) { 807 808 $spam_uri = 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 ); 808 809 if ( bbp_is_reply_spam( $reply->ID ) ) { 809 810 $actions['spam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark the reply as not spam', 'bbpress' ) . '">' . esc_html__( 'Not spam', 'bbpress' ) . '</a>'; -
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_sticky', 'stuck', 'unstuck', '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_sticky', 'stuck', 'unstuck', '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? … … 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
237 237 add_action( 'bbp_delete_topic', 'bbp_unstick_topic' ); 238 238 239 239 // Update topic branch 240 add_action( 'bbp_trashed_topic', 'bbp_update_topic_walker' ); 241 add_action( 'bbp_untrashed_topic', 'bbp_update_topic_walker' ); 242 add_action( 'bbp_deleted_topic', 'bbp_update_topic_walker' ); 243 add_action( 'bbp_spammed_topic', 'bbp_update_topic_walker' ); 244 add_action( 'bbp_unspammed_topic', 'bbp_update_topic_walker' ); 240 add_action( 'bbp_trashed_topic', 'bbp_update_topic_walker' ); 241 add_action( 'bbp_untrashed_topic', 'bbp_update_topic_walker' ); 242 add_action( 'bbp_deleted_topic', 'bbp_update_topic_walker' ); 243 add_action( 'bbp_spammed_topic', 'bbp_update_topic_walker' ); 244 add_action( 'bbp_unspammed_topic', 'bbp_update_topic_walker' ); 245 add_action( 'bbp_approved_topic', 'bbp_update_topic_walker' ); 246 add_action( 'bbp_unapproved_topic', 'bbp_update_topic_walker' ); 245 247 246 248 // Update reply branch 247 add_action( 'bbp_trashed_reply', 'bbp_update_reply_walker' ); 248 add_action( 'bbp_untrashed_reply', 'bbp_update_reply_walker' ); 249 add_action( 'bbp_deleted_reply', 'bbp_update_reply_walker' ); 250 add_action( 'bbp_spammed_reply', 'bbp_update_reply_walker' ); 251 add_action( 'bbp_unspammed_reply', 'bbp_update_reply_walker' ); 249 add_action( 'bbp_trashed_reply', 'bbp_update_reply_walker' ); 250 add_action( 'bbp_untrashed_reply', 'bbp_update_reply_walker' ); 251 add_action( 'bbp_deleted_reply', 'bbp_update_reply_walker' ); 252 add_action( 'bbp_spammed_reply', 'bbp_update_reply_walker' ); 253 add_action( 'bbp_unspammed_reply', 'bbp_update_reply_walker' ); 254 add_action( 'bbp_approved_reply', 'bbp_update_reply_walker' ); 255 add_action( 'bbp_unapproved_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' ); … … 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' );