Changeset 5583 for trunk/src/includes/admin/topics.php
- Timestamp:
- 12/07/2014 08:42:18 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/admin/topics.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/topics.php
r5496 r5583 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 ) ); … … 448 449 .status-spam { 449 450 background-color: #faeaea; 451 } 452 453 .status-pending { 454 background-color: #fef7f1; 450 455 } 451 456 … … 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 … … 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 ); … … 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? … … 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 ); 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 ); 656 686 break; 657 687 } … … 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 … … 854 894 } 855 895 856 // Dont show sticky if topic links is spam or trash 857 if ( !bbp_is_topic_spam( $topic->ID ) && !bbp_is_topic_trash( $topic->ID ) ) { 858 859 // Sticky 860 $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 ); 896 // Sticky 897 // Dont show sticky if topic links is spam, trash or pending 898 if ( ! bbp_is_topic_spam( $topic->ID ) && ! bbp_is_topic_trash( $topic->ID ) && ! bbp_is_topic_pending( $topic->ID ) ) { 899 $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 ); 861 900 if ( bbp_is_topic_sticky( $topic->ID ) ) { 862 901 $actions['stick'] = '<a href="' . esc_url( $stick_uri ) . '" title="' . esc_attr__( 'Unstick this topic', 'bbpress' ) . '">' . esc_html__( 'Unstick', 'bbpress' ) . '</a>'; … … 868 907 869 908 // Spam 870 $spam_uri = wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_spam' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'spam-topic_' . $topic->ID );909 $spam_uri = wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_spam' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'spam-topic_' . $topic->ID ); 871 910 if ( bbp_is_topic_spam( $topic->ID ) ) { 872 911 $actions['spam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark the topic as not spam', 'bbpress' ) . '">' . esc_html__( 'Not spam', 'bbpress' ) . '</a>';
Note: See TracChangeset
for help on using the changeset viewer.