Changeset 5329 for sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-moderators.php
- Timestamp:
- 04/13/2017 10:04:57 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-moderators.php
r5306 r5329 45 45 46 46 // Convert toggle links to explicit actions. 47 add_filter( 'bbp_get_topic_close_link', array( $this, 'convert_toggles_to_actions' ), 10, 3 ); 48 add_filter( 'bbp_get_topic_stick_link', array( $this, 'convert_toggles_to_actions' ), 10, 3 ); 47 49 add_filter( 'bbp_get_topic_spam_link', array( $this, 'convert_toggles_to_actions' ), 10, 3 ); 48 50 add_filter( 'bbp_get_topic_approve_link', array( $this, 'convert_toggles_to_actions' ), 10, 3 ); … … 440 442 public function get_topic_actions( $actions ) { 441 443 $actions = array_merge( $actions, array( 444 'wporg_bbp_close_topic', 445 'wporg_bbp_open_topic', 446 'wporg_bbp_stick_topic', 447 'wporg_bbp_unstick_topic', 442 448 'wporg_bbp_spam_topic', 443 449 'wporg_bbp_unspam_topic', … … 614 620 615 621 switch ( $r['action'] ) { 622 case 'wporg_bbp_close_topic': 623 check_ajax_referer( "close-{$nonce_suffix}" ); 624 625 if ( bbp_is_topic_open( $r['id'] ) ) { 626 $retval['status'] = bbp_close_topic( $r['id'] ); 627 $retval['message'] = __( '<strong>ERROR</strong>: There was a problem closing the topic.', 'wporg-forums' ); 628 } 629 630 break; 631 632 case 'wporg_bbp_open_topic': 633 check_ajax_referer( "close-{$nonce_suffix}" ); 634 635 if ( ! bbp_is_topic_open( $r['id'] ) ) { 636 $retval['status'] = bbp_open_topic( $r['id'] ); 637 $retval['message'] = __( '<strong>ERROR</strong>: There was a problem opening the topic.', 'wporg-forums' ); 638 } 639 640 break; 641 642 case 'wporg_bbp_stick_topic': 643 check_ajax_referer( "stick-{$nonce_suffix}" ); 644 645 if ( ! bbp_is_topic_sticky( $r['id'] ) ) { 646 $retval['status'] = bbp_stick_topic( $r['id'], ! empty( $_GET['super'] ) ); 647 $retval['message'] = __( '<strong>ERROR</strong>: There was a problem sticking the topic.', 'wporg-forums' ); 648 } 649 650 break; 651 652 case 'wporg_bbp_unstick_topic': 653 check_ajax_referer( "stick-{$nonce_suffix}" ); 654 655 if ( bbp_is_topic_sticky( $r['id'] ) ) { 656 $retval['status'] = bbp_unstick_topic( $r['id'] ); 657 $retval['message'] = __( '<strong>ERROR</strong>: There was a problem unsticking the topic.', 'wporg-forums' ); 658 } 659 660 break; 661 616 662 case 'wporg_bbp_spam_topic': 617 663 check_ajax_referer( "spam-{$nonce_suffix}" ); 618 664 619 665 if ( ! bbp_is_topic_spam( $r['id'] ) ) { 620 $retval['status'] 621 $retval['message'] 666 $retval['status'] = bbp_spam_topic( $r['id'] ); 667 $retval['message'] = __( '<strong>ERROR</strong>: There was a problem marking the topic as spam.', 'wporg-forums' ); 622 668 } 623 669 $retval['view_all'] = true; … … 629 675 630 676 if ( bbp_is_topic_spam( $r['id'] ) ) { 631 $retval['status'] 632 $retval['message'] 677 $retval['status'] = bbp_unspam_topic( $r['id'] ); 678 $retval['message'] = __( '<strong>ERROR</strong>: There was a problem unmarking the topic as spam.', 'wporg-forums' ); 633 679 } 634 680 $retval['view_all'] = false; … … 640 686 641 687 if ( ! bbp_is_topic_pending( $r['id'] ) ) { 642 $retval['status'] 643 $retval['message'] 688 $retval['status'] = bbp_unapprove_topic( $r['id'] ); 689 $retval['message'] = __( '<strong>ERROR</strong>: There was a problem unapproving the topic.', 'wporg-forums' ); 644 690 } 645 691 $retval['view_all'] = true; … … 651 697 652 698 if ( bbp_is_topic_pending( $r['id'] ) ) { 653 $retval['status'] 654 $retval['message'] 699 $retval['status'] = bbp_approve_topic( $r['id'] ); 700 $retval['message'] = __( '<strong>ERROR</strong>: There was a problem approving the topic.', 'wporg-forums' ); 655 701 } 656 702 $retval['view_all'] = false; … … 749 795 */ 750 796 public function convert_toggles_to_actions( $link, $r, $args ) { 751 if ( false !== strpos( $link, 'bbp_toggle_topic_spam' ) ) { 797 if ( false !== strpos( $link, 'bbp_toggle_topic_close' ) ) { 798 $action = ( bbp_is_topic_closed( $r['id'] ) ) ? 'wporg_bbp_open_topic' : 'wporg_bbp_close_topic'; 799 $link = str_replace( 'bbp_toggle_topic_close', $action, $link ); 800 801 } elseif ( false !== strpos( $link, 'bbp_toggle_topic_stick' ) ) { 802 $action = ( bbp_is_topic_sticky( $r['id'] ) ) ? 'wporg_bbp_unstick_topic' : 'wporg_bbp_stick_topic'; 803 $link = str_replace( 'bbp_toggle_topic_stick', $action, $link ); 804 805 } elseif ( false !== strpos( $link, 'bbp_toggle_topic_spam' ) ) { 752 806 $action = ( bbp_is_topic_spam( $r['id'] ) ) ? 'wporg_bbp_unspam_topic' : 'wporg_bbp_spam_topic'; 753 807 $link = str_replace( 'bbp_toggle_topic_spam', $action, $link );
Note: See TracChangeset
for help on using the changeset viewer.