Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/15/2013 08:57:09 PM (6 years ago)
Author:
boonebgorges
Message:

Support more liberal params for disabling comments in bp_has_activities()

The 'display_comments' argument of bp_has_activities() takes either a string
value (such as 'threaded') or a bool false to disable comments altogether.
However, the false check in the query method is strict, meaning that various
analogous null values for display_comments were not recognized. In particular,
the strict check made it impossible to disable activity comments via a
querystring, as is often done in templates: ?display_comments=0.

This changeset adds 0, '0', 'false', and 'none' to the possible values for
the null display_comments value, to support the longtime codex suggestions.
Changes are made at the level of bp_has_activities(), which means that the
query method still requires a string false for $display_comments.

Fixes #5029

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-template.php

    r7570 r7574  
    530530    extract( $r );
    531531
     532    // Translate various values for 'display_comments'
     533    // This allows disabling comments via ?display_comments=0
     534    // or =none or =false. Final true is a strict type check. See #5029
     535    if ( in_array( $display_comments, array( 0, '0', 'none', 'false' ), true ) ) {
     536        $display_comments = false;
     537    }
     538
    532539    if ( empty( $search_terms ) && ! empty( $_REQUEST['s'] ) )
    533540        $search_terms = $_REQUEST['s'];
Note: See TracChangeset for help on using the changeset viewer.