Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/21/2011 02:14:16 PM (13 years ago)
Author:
boonebgorges
Message:

Fixes sticky logic on group forum directories so that stickies always appear at the top of the order, without breaking pagination. Fixes #3059. Props sushkov for the inital patch. Introduces bp_forums_enable_global_directory_stickies() to allow easy modification of the default global forum directory behavior, which is to show group stickies in their normal freshness-based position.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-forums/bp-forums-functions.php

    r4709 r4764  
    8181        'page'          => 1,
    8282        'per_page'      => 15,
     83        'offset'    => false,
     84        'number'    => false,
    8385        'exclude'       => false,
    8486        'show_stickies' => 'all',
     
    9294        switch ( $type ) {
    9395            case 'newest':
    94                 $query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'topic_author_id' => $user_id, 'per_page' => $per_page, 'page' => $page, 'number' => $per_page, 'exclude' => $exclude, 'topic_title' => $filter, 'sticky' => $show_stickies ), 'get_latest_topics' );
     96                $query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'topic_author_id' => $user_id, 'per_page' => $per_page, 'page' => $page, 'number' => $per_page, 'exclude' => $exclude, 'topic_title' => $filter, 'sticky' => $show_stickies, 'offset' => $offset, 'number' => $number ), 'get_latest_topics' );
    9597                $topics =& $query->results;
    9698                break;
     
    491493
    492494/**
    493  * Returs the parent forum id for the bbPress abstraction layer
     495 * Returns the parent forum id for the bbPress abstraction layer
    494496 *
    495497 * @package BuddyPress
     
    500502function bp_forums_parent_forum_id() {
    501503    return apply_filters( 'bp_forums_parent_forum_id', BP_FORUMS_PARENT_FORUM_ID );
     504}
     505
     506/**
     507 * Should sticky topics be broken out of regular topic order on forum directories?
     508 *
     509 * Defaults to false. Define BP_FORUMS_ENABLE_GLOBAL_DIRECTORY_STICKIES, or filter
     510 * bp_forums_enable_global_directory_stickies, to change this behavior.
     511 *
     512 * @package BuddyPress
     513 * @since 1.3
     514 *
     515 * @return bool True if stickies should be displayed at the top of the global directory, false
     516 *    otherwise.
     517 */
     518function bp_forums_enable_global_directory_stickies() {
     519    return apply_filters( 'bp_forums_enable_global_directory_stickies', defined( 'BP_FORUMS_ENABLE_GLOBAL_DIRECTORY_STICKIES' ) && BP_FORUMS_ENABLE_GLOBAL_DIRECTORY_STICKIES );
    502520}
    503521
Note: See TracChangeset for help on using the changeset viewer.