Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/19/2016 07:35:41 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Statuses, Types, Visibilities: Pass the forum, topic, or reply ID into helper functions.

These ID's pass additional context into respective filters, useful for fine-grained control over UI elements.

This commit normalizes the way these functions work across all of bbPress where applicable, by ensuring all similar functions accept an ID and assume 0 by default. Note that there are currently 2 locations where no ID exists to pass context into, which is by design.

Fixes #2954.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/forums/functions.php

    r5954 r6026  
    17911791 * @since 2.4.0 bbPress (r5059)
    17921792 *
     1793 * @param int $forum_id   Optional. Forum id.
     1794 *
    17931795 * @return array
    17941796 */
    1795 function bbp_get_forum_statuses() {
     1797function bbp_get_forum_statuses( $forum_id = 0 ) {
    17961798    return apply_filters( 'bbp_get_forum_statuses', array(
    17971799        'open'   => _x( 'Open',    'Open the forum',  'bbpress' ),
    17981800        'closed' => _x( 'Closed',  'Close the forum', 'bbpress' )
    1799     ) );
     1801    ), $forum_id );
    18001802}
    18011803
     
    18051807 * @since 2.4.0 bbPress (r5059)
    18061808 *
     1809 * @param int $forum_id   Optional. Forum id.
     1810 *
    18071811 * @return array
    18081812 */
    1809 function bbp_get_forum_types() {
     1813function bbp_get_forum_types( $forum_id = 0 ) {
    18101814    return apply_filters( 'bbp_get_forum_types', array(
    18111815        'forum'    => _x( 'Forum',    'Forum accepts new topics', 'bbpress' ),
    18121816        'category' => _x( 'Category', 'Forum is a category',      'bbpress' )
    1813     ) );
     1817    ), $forum_id );
    18141818}
    18151819
     
    18191823 * @since 2.4.0 bbPress (r5059)
    18201824 *
     1825 * @param int $forum_id   Optional. Forum id.
     1826 *
    18211827 * @return array
    18221828 */
    1823 function bbp_get_forum_visibilities() {
     1829function bbp_get_forum_visibilities( $forum_id = 0) {
    18241830    return apply_filters( 'bbp_get_forum_visibilities', array(
    18251831        bbp_get_public_status_id()  => _x( 'Public',  'Make forum public',  'bbpress' ),
    18261832        bbp_get_private_status_id() => _x( 'Private', 'Make forum private', 'bbpress' ),
    18271833        bbp_get_hidden_status_id()  => _x( 'Hidden',  'Make forum hidden',  'bbpress' )
    1828     ) );
     1834    ), $forum_id );
    18291835}
    18301836
Note: See TracChangeset for help on using the changeset viewer.