Making WordPress.org


Ignore:
Timestamp:
02/21/2017 01:50:51 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Use bbp_topic_admin_links and bbp_reply_admin_links filters to remove the Trash link.

Their get_* equivalents operate on the resulting markup, instead of just the links array, and require more code for the same thing.

File:
1 edited

Legend:

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

    r4944 r4970  
    1010
    1111        // Display-related filters and actions.
    12         add_filter( 'bbp_get_topic_admin_links', array( $this, 'get_admin_links' ), 10, 3 );
    13         add_filter( 'bbp_get_reply_admin_links', array( $this, 'get_admin_links' ), 10, 3 );
     12        add_filter( 'bbp_topic_admin_links', array( $this, 'admin_links' ), 10, 3 );
     13        add_filter( 'bbp_reply_admin_links', array( $this, 'admin_links' ), 10, 3 );
    1414
    1515        // Gravatar suppression on lists of topics.
     
    4646     * permanently delete it when the trash is emptied. Better to mark it as
    4747     * pending or spam.
    48      */
    49     public function get_admin_links( $retval, $r, $args ) {
    50         unset( $r['links']['trash'] );
    51 
    52         $links = implode( $r['sep'], array_filter( $r['links'] ) );
    53         $retval = $r['before'] . $links . $r['after'];
    54 
    55         return $retval;
     48     *
     49     * @param array $r       Admin links array.
     50     * @param int   $post_id Topic or reply ID.
     51     * @return array Filtered admin links array.
     52     */
     53    public function admin_links( $r, $post_id ) {
     54        unset( $r['trash'] );
     55
     56        return $r;
    5657    }
    5758
Note: See TracChangeset for help on using the changeset viewer.