Making WordPress.org

Changeset 5357


Ignore:
Timestamp:
04/18/2017 02:02:17 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Show 'Sticky Topic' indicator in individual plugin- and theme-specific sticky topics.

File:
1 edited

Legend:

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

    r5301 r5357  
    3232        add_filter( 'bbp_get_stickies', array( $this, 'get_compat_stickies' ), 10, 2 );
    3333
     34        // Make bbp_is_topic_sticky() recognize compat stickies.
     35        add_filter( 'bbp_is_topic_sticky', array( $this, 'is_topic_sticky' ), 10, 2 );
     36
    3437        // Add topic toggle for compat authors.
    3538        add_action( 'bbp_get_request', array( $this, 'sticky_handler' ) );
     
    4245     * Return empty array for super sticky topics in compat mode.
    4346     *
    44      * @param array $stickies The super sticky topic ids
    45      * @return array An empty array
     47     * @param array $stickies The super sticky topic IDs.
     48     * @return array An empty array.
    4649     */
    4750    public function get_super_stickies( $stickies ) {
     
    5255     * Return compat stickies for a given term.
    5356     *
    54      * @param array $stickies The sticky topic ids
    55      * @param int $forum_id The forum id
    56      * @return array The sticky topic ids
     57     * @param array $stickies The sticky topic IDs.
     58     * @param int   $forum_id The forum ID.
     59     * @return array The sticky topic IDs.
    5760     */
    5861    public function get_compat_stickies( $stickies, $forum_id ) {
     
    6164        }
    6265        return $stickies;
     66    }
     67
     68    /**
     69     * Check whether a compat topic is sticky.
     70     *
     71     * @param bool $is_sticky Whether the topic is sticky.
     72     * @param int  $topic     The topic ID.
     73     * @return bool Whether the topic is sticky.
     74     */
     75    public function is_topic_sticky( $is_sticky, $topic_id ) {
     76        if ( $this->term && bbp_is_single_topic() ) {
     77            $is_sticky = self::is_sticky( $this->term->term_id, $topic_id );
     78        }
     79        return $is_sticky;
    6380    }
    6481
Note: See TracChangeset for help on using the changeset viewer.