Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/27/2017 05:04:31 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Tools: Add //Filter & return note for future discovery of missing filter documentation.

Also adjust some type-casting on filtered results.

File:
1 edited

Legend:

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

    r6422 r6438  
    4040    }
    4141
     42    // Filter & return
    4243    return apply_filters( 'bbp_redirect_login', $url, $raw_url, $user );
    4344}
     
    5556 */
    5657function bbp_is_anonymous() {
    57     if ( ! is_user_logged_in() && bbp_allow_anonymous() ) {
    58         $is_anonymous = true;
    59     } else {
    60         $is_anonymous = false;
    61     }
    62 
    63     return apply_filters( 'bbp_is_anonymous', $is_anonymous );
     58    $is_anonymous = ( ! is_user_logged_in() && bbp_allow_anonymous() );
     59
     60    // Filter & return
     61    return (bool) apply_filters( 'bbp_is_anonymous', $is_anonymous );
    6462}
    6563
     
    167165    $retval = preg_replace( '/[^0-9a-fA-F:., ]/', '', $remote_address );
    168166
     167    // Filter & return
    169168    return apply_filters( 'bbp_current_author_ip', $retval, $remote_address );
    170169}
     
    182181        : '';
    183182
     183    // Filter & return
    184184    return apply_filters( 'bbp_current_author_ua', $retval );
    185185}
     
    553553    ) );
    554554
     555    // Filter & return
    555556    return apply_filters( 'bbp_get_user_topics_started', $query, $user_id );
    556557}
     
    581582    ) );
    582583
     584    // Filter & return
    583585    return apply_filters( 'bbp_get_user_replies_created', $query, $user_id );
    584586}
     
    595597function bbp_get_total_users() {
    596598    $user_count = count_users();
    597     return apply_filters( 'bbp_get_total_users', (int) $user_count['total_users'] );
     599
     600    // Filter & return
     601    return (int) apply_filters( 'bbp_get_total_users', (int) $user_count['total_users'] );
    598602}
    599603
     
    632636    }
    633637
    634     return apply_filters( 'bbp_get_user_ids_from_nicenames', $retval, $user_nicenames );
     638    // Filter & return
     639    return (array) apply_filters( 'bbp_get_user_ids_from_nicenames', $retval, $user_nicenames );
    635640}
    636641
     
    664669    }
    665670
    666     return apply_filters( 'bbp_get_user_nicenames_from_ids', $retval, $user_ids );
     671    // Filter & return
     672    return (array) apply_filters( 'bbp_get_user_nicenames_from_ids', $retval, $user_ids );
    667673}
    668674
     
    693699    $count = $count + bbp_get_user_closed_topic_count( $user_id );
    694700
     701    // Filter & return
    695702    return (int) apply_filters( 'bbp_get_user_topic_count_raw', $count, $user_id );
    696703}
     
    718725    $count = count_user_posts( $user_id, bbp_get_reply_post_type(), false );
    719726
     727    // Filter & return
    720728    return (int) apply_filters( 'bbp_get_user_reply_count_raw', $count, $user_id );
    721729}
     
    748756    ) );
    749757
     758    // Filter & return
    750759    return (int) apply_filters( 'bbp_get_user_closed_topic_count', $count, $user_id );
    751760}
Note: See TracChangeset for help on using the changeset viewer.