Making WordPress.org


Ignore:
Timestamp:
03/07/2017 03:40:24 PM (10 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Append 'view=all' to forum, topic, and reply URLs in moderator views.

The code is relocated from the wporg-support theme.

File:
1 edited

Legend:

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

    r5088 r5110  
    1717                // Scripts and styles.
    1818                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
     19
     20                // Append 'view=all' to forum, topic, and reply URLs in moderator views.
     21                add_filter( 'bbp_get_forum_permalink',          array( $this, 'add_view_all' ) );
     22                add_filter( 'bbp_get_topic_permalink',          array( $this, 'add_view_all' ) );
     23                add_filter( 'bbp_get_reply_url',                array( $this, 'add_view_all' ) );
    1924
    2025                // Archived post status.
    … …  
    8792                        wp_enqueue_style( 'support-forums-moderators', plugins_url( 'css/styles-moderators.css', __DIR__ ) );
    8893                }
     94        }
     95
     96        /**
     97         * Append 'view=all' to forum, topic, and reply URLs in moderator views.
     98         *
     99         * @param string $url Forum, topic, or reply URL.
     100         * @return string Filtered URL.
     101         */
     102        function add_view_all( $url ) {
     103                if ( bbp_is_single_view() && in_array( bbp_get_view_id(), self::VIEWS ) ) {
     104                        $url = add_query_arg( 'view', 'all', $url );
     105                }
     106
     107                return $url;
    89108        }
    90109
Note: See TracChangeset for help on using the changeset viewer.