Making WordPress.org


Ignore:
Timestamp:
04/09/2017 08:31:01 AM (9 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Move Hooks::admin_links() to Moderators class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

    r5291 r5300  
    1111        add_filter( 'pre_option__bbp_edit_lock',      array( $this, 'increase_edit_lock_time' ) );
    1212        add_filter( 'redirect_canonical',             array( $this, 'disable_redirect_guess_404_permalink' ) );
    13 
    14         // Display-related filters and actions.
    15         add_filter( 'bbp_topic_admin_links', array( $this, 'admin_links' ), 10, 3 );
    16         add_filter( 'bbp_reply_admin_links', array( $this, 'admin_links' ), 10, 3 );
    1713
    1814        // Gravatar suppression on lists of topics and revision logs.
     
    9793
    9894        return $redirect_url;
    99     }
    100 
    101     /**
    102      * Remove some unneeded or redundant admin links for topics and replies,
    103      * move less commonly used inline quick links to 'Topic Admin' sidebar section.
    104      *
    105      * @param array $r       Admin links array.
    106      * @param int   $post_id Topic or reply ID.
    107      * @return array Filtered admin links array.
    108      */
    109     public function admin_links( $r, $post_id ) {
    110         /*
    111          * Remove 'Trash' from admin links. Trashing a topic or reply will eventually
    112          * permanently delete it when the trash is emptied. Better to mark it as pending or spam.
    113          */
    114         unset( $r['trash'] );
    115 
    116         /*
    117          * Remove 'Reply' link. The theme adds its own 'Reply to Topic' sidebar link
    118          * for quick access to reply form, making the default inline link redundant.
    119          */
    120         unset( $r['reply'] );
    121 
    122         /*
    123          * The following actions are removed from inline quick links as less commonly used,
    124          * but are still available via 'Topic Admin' sidebar section.
    125          */
    126         if ( ! did_action( 'wporg_compat_single_topic_sidebar_pre' ) ) {
    127             // Remove 'Merge' link.
    128             unset( $r['merge'] );
    129 
    130             // Remove 'Stick' link for moderators, but keep it for plugin/theme authors and contributors.
    131             if ( current_user_can( 'moderate', $post_id ) ) {
    132                 unset( $r['stick'] );
    133             }
    134         }
    135 
    136         return $r;
    13795    }
    13896
Note: See TracChangeset for help on using the changeset viewer.