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/engagements.php

    r6422 r6438  
    3232    $retval = add_metadata( $meta_type, $object_id, $meta_key, $user_id, false );
    3333
     34    // Filter & return
    3435    return (bool) apply_filters( 'bbp_add_user_to_object', (bool) $retval, $object_id, $user_id, $meta_key, $meta_type );
    3536}
     
    5455    $retval = delete_metadata( $meta_type, $object_id, $meta_key, $user_id, false );
    5556
     57    // Filter & return
    5658    return (bool) apply_filters( 'bbp_remove_user_from_object', (bool) $retval, $object_id, $user_id, $meta_key, $meta_type );
    5759}
     
    7577    $retval = wp_parse_id_list( $meta );
    7678
    77     return (array) apply_filters( 'bbp_get_users_for_object', (array) $retval, $object_id, $meta_key, $meta_type );
     79    // Filter & return
     80    return (array) apply_filters( 'bbp_get_users_for_object', $retval, $object_id, $meta_key, $meta_type );
    7881}
    7982
     
    98101    $retval   = is_numeric( array_search( $user_id, $user_ids, true ) );
    99102
    100     return (bool) apply_filters( 'bbp_is_object_of_user', (bool) $retval, $object_id, $user_id, $meta_key, $meta_type );
     103    // Filter & return
     104    return (bool) apply_filters( 'bbp_is_object_of_user', $retval, $object_id, $user_id, $meta_key, $meta_type );
    101105}
    102106
     
    118122    $users    = bbp_get_users_for_object( $topic_id, '_bbp_engagement' );
    119123
     124    // Filter & return
    120125    return (array) apply_filters( 'bbp_get_topic_engagements', $users, $topic_id );
    121126}
     
    144149    ) );
    145150
     151    // Filter & return
    146152    return apply_filters( 'bbp_get_user_engagements', $engagements, $user_id );
    147153}
     
    173179    ) );
    174180
     181    // Filter & return
    175182    return (array) apply_filters( 'bbp_get_user_engaged_topic_ids', $engagements->posts, $user_id );
    176183}
     
    195202    $retval   = bbp_is_object_of_user( $topic_id, $user_id, '_bbp_engagement' );
    196203
     204    // Filter & return
    197205    return (bool) apply_filters( 'bbp_is_user_engaged', (bool) $retval, $user_id, $topic_id );
    198206}
     
    288296    $users    = bbp_get_users_for_object( $topic_id, '_bbp_favorite' );
    289297
     298    // Filter & return
    290299    return (array) apply_filters( 'bbp_get_topic_favoriters', $users, $topic_id );
    291300}
     
    314323    ) );
    315324
     325    // Filter & return
    316326    return apply_filters( 'bbp_get_user_favorites', $query, $user_id );
    317327}
     
    343353    ) );
    344354
     355    // Filter & return
    345356    return (array) apply_filters( 'bbp_get_user_favorites_topic_ids', $favorites->posts, $user_id );
    346357}
     
    389400    }
    390401
     402    // Filter & return
    391403    return (bool) apply_filters( 'bbp_is_user_favorite', (bool) $retval, $user_id, $topic_id, $favorites );
    392404}
     
    585597    $users    = bbp_get_users_for_object( $forum_id, '_bbp_subscription' );
    586598
     599    // Filter & return
    587600    return (array) apply_filters( 'bbp_get_forum_subscribers', $users, $forum_id );
    588601}
     
    602615    $users    = bbp_get_users_for_object( $topic_id, '_bbp_subscription' );
    603616
     617    // Filter & return
    604618    return (array) apply_filters( 'bbp_get_topic_subscribers', $users, $topic_id );
    605619}
     
    619633    _deprecated_function( __FUNCTION__, 2.5, 'bbp_get_user_topic_subscriptions()' );
    620634    $query = bbp_get_user_topic_subscriptions( $user_id );
     635
     636    // Filter & return
    621637    return apply_filters( 'bbp_get_user_subscriptions', $query, $user_id );
    622638}
     
    645661    ) );
    646662
     663    // Filter & return
    647664    return apply_filters( 'bbp_get_user_topic_subscriptions', $query, $user_id );
    648665}
     
    671688    ) );
    672689
     690    // Filter & return
    673691    return apply_filters( 'bbp_get_user_forum_subscriptions', $query, $user_id );
    674692}
     
    700718    ) );
    701719
     720    // Filter & return
    702721    return (array) apply_filters( 'bbp_get_user_subscribed_forum_ids', $subscriptions->posts, $user_id );
    703722}
     
    729748    ) );
    730749
     750    // Filter & return
    731751    return (array) apply_filters( 'bbp_get_user_subscribed_topic_ids', $subscriptions->posts, $user_id );
    732752}
     
    783803    }
    784804
     805    // Filter & return
    785806    return (bool) apply_filters( 'bbp_is_user_subscribed', $retval, $user_id, $object_id, $subscribed_ids );
    786807}
     
    840861    }
    841862
     863    // Filter & return
    842864    return (bool) apply_filters( 'bbp_is_user_subscribed_to_forum', (bool) $retval, $user_id, $forum_id, $subscribed_ids );
    843865}
     
    897919    }
    898920
     921    // Filter & return
    899922    return (bool) apply_filters( 'bbp_is_user_subscribed_to_topic', (bool) $retval, $user_id, $topic_id, $subscribed_ids );
    900923}
Note: See TracChangeset for help on using the changeset viewer.