Skip to:
Content

BuddyPress.org

Changeset 9175


Ignore:
Timestamp:
11/25/2014 03:00:37 PM (11 years ago)
Author:
boonebgorges
Message:

Add hook documentation in bp-friends-notifications.php.

Props tw2113.
See #5942.

File:
1 edited

Legend:

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

    r9153 r9175  
    5757    }
    5858
    59     // Send the message
     59    /**
     60     * Filters the email address for who is getting the friend request.
     61     *
     62     * @since BuddyPress (1.2.0)
     63     *
     64     * @param string $to Email address for who is getting the friend request.
     65     */
    6066    $to      = apply_filters( 'friends_notification_new_request_to', $to );
     67
     68    /**
     69     * Filters the subject for the friend request email.
     70     *
     71     * @since BuddyPress (1.2.0)
     72     *
     73     * @param string $subject Subject line to be used in friend request email.
     74     * @param string $initiator_name Name of the person requesting friendship.
     75     */
    6176    $subject = apply_filters( 'friends_notification_new_request_subject', $subject, $initiator_name );
     77
     78    /**
     79     * Filters the message for the friend request email.
     80     *
     81     * @since BuddyPress (1.2.0)
     82     *
     83     * @param string $message Message to be used in friend request email.
     84     * @param string $initiator_name Name of the person requesting friendship.
     85     * @param string $initiator_link Profile link of person requesting friendship.
     86     * @param string $all_requests_link User's friends request management link.
     87     * @param string $settings_link Email recipient's settings management link.
     88     */
    6289    $message = apply_filters( 'friends_notification_new_request_message', $message, $initiator_name, $initiator_link, $all_requests_link, $settings_link );
    6390
    6491    wp_mail( $to, $subject, $message );
    6592
     93    /**
     94     * Fires after the new friend request email is sent.
     95     *
     96     * @since BuddyPress (1.5.0)
     97     *
     98     * @param int    $friend_id ID of the request recipient.
     99     * @param string $subject Text for the friend request subject field.
     100     * @param string $message Text for the friend request message field.
     101     * @param int    $friendship_id ID of the friendship object.
     102     * @param int    $initiator_id ID of the friendship requester.
     103     */
    66104    do_action( 'bp_friends_sent_request_email', $friend_id, $subject, $message, $friendship_id, $initiator_id );
    67105}
     
    106144    }
    107145
    108     // Send the message
     146    /**
     147     * Filters the email address for whose friend request got accepted.
     148     *
     149     * @since BuddyPress (1.2.0)
     150     *
     151     * @param string $to Email address for whose friend request got accepted.
     152     */
    109153    $to      = apply_filters( 'friends_notification_accepted_request_to', $to );
     154
     155    /**
     156     * Filters the subject for the friend request accepted email.
     157     *
     158     * @since BuddyPress (1.2.0)
     159     *
     160     * @param string $subject Subject line to be used in friend request accepted email.
     161     * @param string $friend_name Name of the person who accepted the friendship request.
     162     */
    110163    $subject = apply_filters( 'friends_notification_accepted_request_subject', $subject, $friend_name );
     164
     165    /**
     166     * Filters the message for the friend request accepted email.
     167     *
     168     * @since BuddyPress (1.2.0)
     169     *
     170     * @param string $message Message to be used in friend request email.
     171     * @param string $friend_name Name of the person who accepted the friendship request.
     172     * @param string $friend_link Profile link of person who accepted the friendship request.
     173     * @param string $settings_link Email recipient's settings management link.
     174     */
    111175    $message = apply_filters( 'friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link );
    112176
    113177    wp_mail( $to, $subject, $message );
    114178
     179    /**
     180     * Fires after the friend request accepted email is sent.
     181     *
     182     * @since BuddyPress (1.5.0)
     183     *
     184     * @param int    $initiator_id ID of the friendship requester.
     185     * @param string $subject Text for the friend request subject field.
     186     * @param string $message Text for the friend request message field.
     187     * @param int    $friendship_id ID of the friendship object.
     188     * @param int    $friend_id ID of the request recipient.
     189     */
    115190    do_action( 'bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id );
    116191}
     
    170245    // Return either an HTML link or an array, depending on the requested format
    171246    if ( 'string' == $format ) {
     247
     248        /**
     249         * Filters the format of friendship notifications based on type and amount * of notifications pending.
     250         *
     251         * This is a variable filter that has four possible versions.
     252         * The four possible versions are:
     253         *   - bp_friends_single_friendship_accepted_notification
     254         *   - bp_friends_multiple_friendship_accepted_notification
     255         *   - bp_friends_single_friendship_request_notification
     256         *   - bp_friends_multiple_friendship_request_notification
     257         *
     258         * @since BuddyPress (1.0.0)
     259         *
     260         * @param string|array $value       Depending on format, an HTML link to new requests profile
     261         *                                  tab or array with link and text.
     262         * @param int          $total_items The total number of messaging-related notifications
     263         *                                  waiting for the user.
     264         * @param int          $item_id     The primary item ID.
     265         */
    172266        $return = apply_filters( 'bp_friends_' . $amount . '_friendship_' . $action . '_notification', '<a href="' . esc_url( $link ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $item_id );
    173267    } else {
     268        /** This filter is documented in bp-friends/bp-friends-notifications.php */
    174269        $return = apply_filters( 'bp_friends_' . $amount . '_friendship_' . $action . '_notification', array(
    175270            'link' => $link,
     
    178273    }
    179274
     275    /**
     276     * Fires at the end of the bp-friends notification format callback.
     277     *
     278     * @since BuddyPress (1.0.0)
     279     *
     280     * @param string       $action            The kind of notification being rendered.
     281     * @param int          $item_id           The primary item ID.
     282     * @param int          $secondary_item_id The secondary item ID.
     283     * @param int          $total_items       The total number of messaging-related notifications
     284     *                                        waiting for the user.
     285     * @param array|string $return            Notification text string or array of link and text.
     286     */
    180287    do_action( 'friends_format_notifications', $action, $item_id, $secondary_item_id, $total_items, $return );
    181288
Note: See TracChangeset for help on using the changeset viewer.