Making WordPress.org


Ignore:
Timestamp:
07/18/2017 10:31:15 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Remove some unneeded or redundant row action links for topics and replies in the admin, for consistency with topic and reply admin links on front end.

Fixes #2794.

File:
1 edited

Legend:

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

    r5677 r5688  
    3737        add_filter( 'bbp_topic_admin_links',            array( $this, 'admin_links' ), 10, 2 );
    3838        add_filter( 'bbp_reply_admin_links',            array( $this, 'admin_links' ), 10, 2 );
     39
     40        // Adjust the list of row actions for topics and replies.
     41        add_filter( 'post_row_actions',                 array( $this, 'row_actions' ), 11, 2 );
    3942
    4043        // Add valid topic and reply actions.
     
    353356     * move less commonly used inline quick links to 'Topic Admin' sidebar section.
    354357     *
    355      * @param array $r       Admin links array.
     358     * @param array $r       An array of admin links.
    356359     * @param int   $post_id Topic or reply ID.
    357      * @return array Filtered admin links array.
     360     * @return array Filtered admin links.
    358361     */
    359362    public function admin_links( $r, $post_id ) {
     
    396399
    397400        return $r;
     401    }
     402
     403    /**
     404     * Remove some unneeded or redundant row action links for topics and replies.
     405     *
     406     * @param array   $actions An array of row action links.
     407     * @param WP_Post $post    The post object.
     408     * @return array Filtered row actions links.
     409     */
     410    public function row_actions( $actions, $post ) {
     411        // Remove 'Trash' link.
     412        unset( $actions['trash'] );
     413
     414        // Remove 'Unapprove' link.
     415        unset( $actions['unapproved'] );
     416
     417        // Remove 'Stick' link for reviews.
     418        if ( Plugin::REVIEWS_FORUM_ID == $post->post_parent ) {
     419            unset( $actions['stick'] );
     420        }
     421       
     422
     423        return $actions;
    398424    }
    399425
Note: See TracChangeset for help on using the changeset viewer.