Skip to:
Content

BuddyPress.org

Changeset 9489


Ignore:
Timestamp:
02/17/2015 05:44:33 AM (5 years ago)
Author:
tw2113
Message:

Adds hooks documentation to bp-groups-notifications.php.

See #5943.

File:
1 edited

Legend:

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

    r9351 r9489  
    9191        $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    9292
    93         /* Send the message */
     93        /**
     94         * Filters the user email that the group update notification will be sent to.
     95         *
     96         * @since BuddyPress (1.2.0)
     97         *
     98         * @param string $to User email the notification is being sent to.
     99         */
    94100        $to      = apply_filters( 'groups_notification_group_updated_to', $to );
     101
     102        /**
     103         * Filters the group update notification subject that will be sent to user.
     104         *
     105         * @since BuddyPress (1.2.0)
     106         *
     107         * @param string          $subject Email notification subject text.
     108         * @param BP_Groups_Group $group   Object holding the current group instance. Passed by reference.
     109         */
    95110        $subject = apply_filters_ref_array( 'groups_notification_group_updated_subject', array( $subject, &$group ) );
     111
     112        /**
     113         * Filters the group update notification message that will be sent to user.
     114         *
     115         * @since BuddyPress (1.2.0)
     116         *
     117         * @param string          $message       Email notification message text.
     118         * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
     119         * @param string          $group_link    URL permalink to the group that was updated.
     120         * @param string          $settings_link URL permalink for the user's notification settings area.
     121         */
    96122        $message = apply_filters_ref_array( 'groups_notification_group_updated_message', array( $message, &$group, $group_link, $settings_link ) );
    97123
     
    101127    }
    102128
     129    /**
     130     * Fires after the notification is sent that a group has been updated.
     131     *
     132     * See https://buddypress.trac.wordpress.org/ticket/3644 for blank message parameter.
     133     *
     134     * @since BuddyPress (1.5.0)
     135     *
     136     * @param array  $user_ids Array of user IDs to notify about the update.
     137     * @param string $subject  Email notification subject text.
     138     * @param string $value    Empty string preventing PHP error.
     139     * @param int    $group_id ID of the group that was updated.
     140     */
    103141    do_action( 'bp_groups_sent_updated_email', $user_ids, $subject, '', $group_id );
    104142}
     
    192230    }
    193231
    194     // Send the message
     232    /**
     233     * Filters the user email that the group membership request will be sent to.
     234     *
     235     * @since BuddyPress (1.2.0)
     236     *
     237     * @param string $to User email the request is being sent to.
     238     */
    195239    $to      = apply_filters( 'groups_notification_new_membership_request_to', $to );
     240
     241    /**
     242     * Filters the group membership request subject that will be sent to user.
     243     *
     244     * @since BuddyPress (1.2.0)
     245     *
     246     * @param string          $subject Membership request email subject text.
     247     * @param BP_Groups_Group $group   Object holding the current group instance. Passed by reference.
     248     */
    196249    $subject = apply_filters_ref_array( 'groups_notification_new_membership_request_subject', array( $subject, &$group ) );
     250
     251    /**
     252     * Filters the group membership request message that will be sent to user.
     253     *
     254     * @since BuddyPress (1.2.0)
     255     *
     256     * @param string          $message              Membership request email message text.
     257     * @param BP_Groups_Group $group                Object holding the current group instance. Passed by reference.
     258     * @param string          $requesting_user_name Username of who is requesting membership.
     259     * @param string          $profile_link         URL permalink for the profile for the user requesting membership.
     260     * @param string          $group_requests       URL permalink for the group requests screen for group being requested membership to.
     261     * @param string          $settings_link        URL permalink for the user's notification settings area.
     262     */
    197263    $message = apply_filters_ref_array( 'groups_notification_new_membership_request_message', array( $message, &$group, $requesting_user_name, $profile_link, $group_requests, $settings_link ) );
    198264
    199265    wp_mail( $to, $subject, $message );
    200266
     267    /**
     268     * Fires after the notification is sent that a member has requested group membership.
     269     *
     270     * @since BuddyPress (1.5.0)
     271     *
     272     * @param int    $admin_id           ID of the group administrator.
     273     * @param string $subject            Email notification subject text.
     274     * @param string $message            Email notification message text.
     275     * @param int    $requesting_user_id ID of the user requesting membership.
     276     * @param int    $group_id           ID of the group receiving membership request.
     277     * @param int    $membership_id      ID of the group membership object.
     278     */
    201279    do_action( 'bp_groups_sent_membership_request_email', $admin_id, $subject, $message, $requesting_user_id, $group_id, $membership_id );
    202280}
     
    270348    }
    271349
    272     // Send the message
     350    /**
     351     * Filters the user email that the group membership request result will be sent to.
     352     *
     353     * @since BuddyPress (1.2.0)
     354     *
     355     * @param string $to User email the request result is being sent to.
     356     */
    273357    $to      = apply_filters( 'groups_notification_membership_request_completed_to', $to );
     358
     359    /**
     360     * Filters the group membership request result subject that will be sent to user.
     361     *
     362     * @since BuddyPress (1.2.0)
     363     *
     364     * @param string          $subject Membership request result email subject text.
     365     * @param BP_Groups_Group $group   Object holding the current group instance. Passed by reference.
     366     */
    274367    $subject = apply_filters_ref_array( 'groups_notification_membership_request_completed_subject', array( $subject, &$group ) );
     368
     369    /**
     370     * Filters the group membership request result message that will be sent to user.
     371     *
     372     * @since BuddyPress (1.2.0)
     373     *
     374     * @param string          $message       Membership request result email message text.
     375     * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
     376     * @param string          $group_link    URL permalink for the group that was requested membership for.
     377     * @param string          $settings_link URL permalink for the user's notification settings area.
     378     */
    275379    $message = apply_filters_ref_array( 'groups_notification_membership_request_completed_message', array( $message, &$group, $group_link, $settings_link ) );
    276380
    277381    wp_mail( $to, $subject, $message );
    278382
     383    /**
     384     * Fires after the notification is sent that a membership has been approved.
     385     *
     386     * @since BuddyPress (1.5.0)
     387     *
     388     * @param int    $requesting_user_id ID of the user whose membership was approved.
     389     * @param string $subject            Email notification subject text.
     390     * @param string $message            Email notification message text.
     391     * @param int    $group_id           ID of the group that was joined.
     392     */
    279393    do_action( 'bp_groups_sent_membership_approved_email', $requesting_user_id, $subject, $message, $group_id );
    280394}
     
    339453    }
    340454
    341     // Send the message
     455    /**
     456     * Filters the user email that the group promotion notification will be sent to.
     457     *
     458     * @since BuddyPress (1.2.0)
     459     *
     460     * @param string $to User email the promotion notification is being sent to.
     461     */
    342462    $to      = apply_filters( 'groups_notification_promoted_member_to', $to );
     463
     464    /**
     465     * Filters the group promotion notification subject that will be sent to user.
     466     *
     467     * @since BuddyPress (1.2.0)
     468     *
     469     * @param string          $subject Promotion notification email subject text.
     470     * @param BP_Groups_Group $group   Object holding the current group instance. Passed by reference.
     471     */
    343472    $subject = apply_filters_ref_array( 'groups_notification_promoted_member_subject', array( $subject, &$group ) );
     473
     474    /**
     475     * Filters the group promotion notification message that will be sent to user.
     476     *
     477     * @since BuddyPress (1.2.0)
     478     *
     479     * @param string          $message       Promotion notification email message text.
     480     * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
     481     * @param string          $promoted_to   Role that the user was promoted to within the group.
     482     * @param string          $group_link    URL permalink for the group that the promotion was related to.
     483     * @param string          $settings_link URL permalink for the user's notification settings area.
     484     */
    344485    $message = apply_filters_ref_array( 'groups_notification_promoted_member_message', array( $message, &$group, $promoted_to, $group_link, $settings_link ) );
    345486
    346487    wp_mail( $to, $subject, $message );
    347488
     489    /**
     490     * Fires after the notification is sent that a member has been promoted.
     491     *
     492     * @since BuddyPress (1.5.0)
     493     *
     494     * @param int    $user_id  ID of the user who was promoted.
     495     * @param string $subject  Email notification subject text.
     496     * @param string $message  Email notification message text.
     497     * @param int    $group_id ID of the group that the user is a member of.
     498     */
    348499    do_action( 'bp_groups_sent_promoted_email', $user_id, $subject, $message, $group_id );
    349500}
     
    417568    }
    418569
    419     // Send the message
     570    /**
     571     * Filters the user email that the group invite notification will be sent to.
     572     *
     573     * @since BuddyPress (1.2.0)
     574     *
     575     * @param string $to User email the invite notification is being sent to.
     576     */
    420577    $to      = apply_filters( 'groups_notification_group_invites_to', $to );
     578
     579    /**
     580     * Filters the group invite notification subject that will be sent to user.
     581     *
     582     * @since BuddyPress (1.2.0)
     583     *
     584     * @param string          $subject Invite notification email subject text.
     585     * @param BP_Groups_Group $group   Object holding the current group instance. Passed by reference.
     586     */
    421587    $subject = apply_filters_ref_array( 'groups_notification_group_invites_subject', array( $subject, &$group ) );
     588
     589    /**
     590     * Filters the group invite notification message that will be sent to user.
     591     *
     592     * @since BuddyPress (1.2.0)
     593     *
     594     * @param string          $message       Invite notification email message text.
     595     * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
     596     * @param string          $inviter_name  Username for the person doing the inviting.
     597     * @param string          $inviter_link  Profile link for the person doing the inviting.
     598     * @param string          $invites_link  URL permalink for the invited user's invite management screen.
     599     * @param string          $group_link    URL permalink for the group that the invite was related to.
     600     * @param string          $settings_link URL permalink for the user's notification settings area.
     601     */
    422602    $message = apply_filters_ref_array( 'groups_notification_group_invites_message', array( $message, &$group, $inviter_name, $inviter_link, $invites_link, $group_link, $settings_link ) );
    423603
    424604    wp_mail( $to, $subject, $message );
    425605
     606    /**
     607     * Fires after the notification is sent that a member has been invited to a group.
     608     *
     609     * @since BuddyPress (1.5.0)
     610     *
     611     * @param int             $invited_user_id  ID of the user who was invited.
     612     * @param string          $subject          Email notification subject text.
     613     * @param string          $message          Email notification message text.
     614     * @param BP_Groups_Group $group            Group object.
     615     */
    426616    do_action( 'bp_groups_sent_invited_email', $invited_user_id, $subject, $message, $group );
    427617}
     
    463653
    464654                if ( 'string' == $format ) {
     655
    465656                    /**
    466657                     * Filters groups multiple new membership request notification for string format.
     
    480671                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . 's_notification', '<a href="' . $notification_link . '" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . $text . '</a>', $group_link, $total_items, $group->name, $text, $notification_link );
    481672                } else {
     673
    482674                    /**
    483675                     * Filters groups multiple new membership request notification for any non-string format.
     
    506698
    507699                if ( 'string' == $format ) {
     700
    508701                    /**
    509702                     * Filters groups single new membership request notification for string format.
     
    523716                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname ) . '">' . $text . '</a>', $group_link, $user_fullname, $group->name, $text, $notification_link );
    524717                } else {
     718
    525719                    /**
    526720                     * Filters groups single new membership request notification for any non-string format.
     
    560754
    561755                if ( 'string' == $format ) {
     756
    562757                    /**
    563758                     * Filters multiple accepted group membership requests notification for string format.
     
    574769                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $group->name, $text, $notification_link );
    575770                } else {
     771
    576772                    /**
    577773                     * Filters multiple accepted group membership requests notification for non-string format.
     
    597793
    598794                if ( 'string' == $format ) {
     795
    599796                    /**
    600797                     * Filters single accepted group membership request notification for string format.
     
    611808                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
    612809                } else {
     810
    613811                    /**
    614812                     * Filters single accepted group membership request notification for non-string format.
     
    645843
    646844                if ( 'string' == $format ) {
     845
    647846                    /**
    648847                     * Filters multiple rejected group membership requests notification for string format.
     
    659858                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $group->name );
    660859                } else {
     860
    661861                    /**
    662862                     * Filters multiple rejected group membership requests notification for non-string format.
     
    681881
    682882                if ( 'string' == $format ) {
     883
    683884                    /**
    684885                     * Filters single rejected group membership requests notification for string format.
     
    695896                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
    696897                } else {
     898
    697899                    /**
    698900                     * Filters single rejected group membership requests notification for non-string format.
     
    701903                     * @since BuddyPress (1.0.0)
    702904                     *
    703                      * @param array  $array              Array holding permalink and content for notification.
     905                     * @param array  $array             Array holding permalink and content for notification.
    704906                     * @param int    $group_link        The permalink for the group.
    705907                     * @param string $group->name       Name of the group.
     
    9631165    }
    9641166
     1167    /**
     1168     * Fires right before returning the formatted group notifications.
     1169     *
     1170     * @since BuddyPress (1.0.0)
     1171     *
     1172     * @param string $action            The type of notification being rendered.
     1173     * @param int    $item_id           The primary item ID.
     1174     * @param int    $secondary_item_id The secondary item ID.
     1175     * @param int    $total_items       Total amount of items to format.
     1176     */
    9651177    do_action( 'groups_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
    9661178
Note: See TracChangeset for help on using the changeset viewer.