Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/24/2021 04:16:17 AM (3 years ago)
Author:
espellcaste
Message:

Making PHPDoc Improvements to the BP Friends (component) files.

Also, adding several minor PHP changes.

See #8553

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-friends/bp-friends-activity.php

    r12602 r13092  
    5050        'secondary_item_id' => false,
    5151        'recorded_time'     => bp_core_current_time(),
    52         'hide_sitewide'     => false
     52        'hide_sitewide'     => false,
    5353    ) );
    5454
     
    7070 *     @type int    $user_id ID of the user associated with the activity item.
    7171 * }
    72  * @return bool True on success, false on failure.
    7372 */
    7473function friends_delete_activity( $args ) {
     
    8180        'item_id'   => $args['item_id'],
    8281        'type'      => $args['type'],
    83         'user_id'   => $args['user_id']
     82        'user_id'   => $args['user_id'],
    8483    ) );
    8584}
     
    8988 *
    9089 * @since 1.1.0
     90 *
     91 * @return bool False if activity component is not active.
    9192 */
    9293function friends_register_activity_actions() {
    9394
    94     if ( !bp_is_active( 'activity' ) ) {
     95    if ( ! bp_is_active( 'activity' ) ) {
    9596        return false;
    9697    }
     
    136137 * @param string $action   Activity action string.
    137138 * @param object $activity Activity data.
    138  * @return string $action Formatted activity action.
     139 * @return string Formatted activity action.
    139140 */
    140141function bp_friends_format_activity_action_friendship_accepted( $action, $activity ) {
     
    171172 * @param string $action   Static activity action.
    172173 * @param object $activity Activity data.
    173  * @return string $action Formatted activity action.
     174 * @return string Formatted activity action.
    174175 */
    175176function bp_friends_format_activity_action_friendship_created( $action, $activity ) {
     
    270271            'column'  => 'user_id',
    271272            'compare' => 'IN',
    272             'value'   => (array) $friends
     273            'value'   => (array) $friends,
    273274        ),
    274275
     
    276277        array(
    277278            'column' => 'hide_sitewide',
    278             'value'  => 0
     279            'value'  => 0,
    279280        ),
    280281
     
    282283        'override' => array(
    283284            'filter'      => array( 'user_id' => 0 ),
    284             'show_hidden' => true
     285            'show_hidden' => true,
    285286        ),
    286287    );
     
    355356                'value'  => $user_id,
    356357            ),
    357         )
     358        ),
    358359    );
    359360
     
    373374 * @since 1.9.0
    374375 *
    375  * @param int         $friendship_id       ID of the friendship.
    376  * @param int         $initiator_user_id   ID of friendship initiator.
    377  * @param int         $friend_user_id      ID of user whose friendship is requested.
    378  * @param object|bool $friendship Optional Friendship object.
    379  */
    380 function bp_friends_friendship_accepted_activity( $friendship_id, $initiator_user_id, $friend_user_id, $friendship = false ) {
     376 * @param int $friendship_id     ID of the friendship.
     377 * @param int $initiator_user_id ID of friendship initiator.
     378 * @param int $friend_user_id    ID of user whose friendship is requested.
     379 */
     380function bp_friends_friendship_accepted_activity( $friendship_id, $initiator_user_id, $friend_user_id ) {
    381381    if ( ! bp_is_active( 'activity' ) ) {
    382382        return;
     
    388388        'type'              => 'friendship_created',
    389389        'item_id'           => $friendship_id,
    390         'secondary_item_id' => $friend_user_id
     390        'secondary_item_id' => $friend_user_id,
    391391    ) );
    392392}
    393 add_action( 'friends_friendship_accepted', 'bp_friends_friendship_accepted_activity', 10, 4 );
     393add_action( 'friends_friendship_accepted', 'bp_friends_friendship_accepted_activity', 10, 3 );
    394394
    395395/**
     
    405405    }
    406406
    407     bp_activity_delete( array(
    408         'component'         => buddypress()->friends->id,
    409         'type'              => 'friendship_created',
    410         'secondary_item_id' => $user_id
    411     ) );
     407    bp_activity_delete(
     408        array(
     409            'component'         => buddypress()->friends->id,
     410            'type'              => 'friendship_created',
     411            'secondary_item_id' => $user_id,
     412        )
     413    );
    412414}
    413415add_action( 'friends_remove_data', 'bp_friends_delete_activity_on_user_delete' );
     
    421423 */
    422424function bp_friends_delete_activity_on_friendship_delete( $friendship_id ) {
    423     friends_delete_activity( array( 'item_id' => $friendship_id, 'type' => 'friendship_created', 'user_id' => 0 ) );
     425    friends_delete_activity(
     426        array(
     427            'item_id' => $friendship_id,
     428            'type'    => 'friendship_created',
     429            'user_id' => 0,
     430        )
     431    );
    424432}
    425433add_action( 'friends_friendship_deleted', 'bp_friends_delete_activity_on_friendship_delete' );
Note: See TracChangeset for help on using the changeset viewer.