Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/22/2015 04:58:34 AM (5 years ago)
Author:
tw2113
Message:

More docs cleanup for BP-Groups component.

See #6401.

File:
1 edited

Legend:

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

    r10148 r10373  
    6666    foreach ( (array) $user_ids as $user_id ) {
    6767
    68         // Continue if member opted out of receiving this email
     68        // Continue if member opted out of receiving this email.
    6969        if ( 'no' === bp_get_user_meta( $user_id, 'notification_groups_group_updated', true ) ) {
    7070            continue;
     
    7373        $ud = bp_core_get_core_userdata( $user_id );
    7474
    75         // Set up and send the message
     75        // Set up and send the message.
    7676        $to = $ud->user_email;
    7777
     
    150150 * @param int $group_id           ID of the group.
    151151 * @param int $membership_id      ID of the group membership object.
    152  *
    153152 * @return false|null False on failure.
    154153 */
    155154function groups_notification_new_membership_request( $requesting_user_id = 0, $admin_id = 0, $group_id = 0, $membership_id = 0 ) {
    156155
    157     // Trigger a BuddyPress Notification
     156    // Trigger a BuddyPress Notification.
    158157    if ( bp_is_active( 'notifications' ) ) {
    159158        bp_notifications_add_notification( array(
     
    166165    }
    167166
    168     // Bail if member opted out of receiving this email
     167    // Bail if member opted out of receiving this email.
    169168    if ( 'no' === bp_get_user_meta( $admin_id, 'notification_groups_membership_request', true ) ) {
    170169        return false;
    171170    }
    172171
    173     // Username of the user requesting a membership: %1$s in mail
     172    // Username of the user requesting a membership: %1$s in mail.
    174173    $requesting_user_name = bp_core_get_user_displayname( $requesting_user_id );
    175174    $group                = groups_get_group( array( 'group_id' => $group_id ) );
    176175
    177     // Group Administrator user's data
     176    // Group Administrator user's data.
    178177    $ud             = bp_core_get_core_userdata( $admin_id );
    179178    $group_requests = bp_get_group_permalink( $group ) . 'admin/membership-requests';
    180179
    181     // Link to the user's profile who's requesting a membership: %3$s in mail
     180    // Link to the user's profile who's requesting a membership: %3$s in mail.
    182181    $profile_link   = bp_core_get_user_domain( $requesting_user_id );
    183182
    184183    $settings_slug  = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    185     // Link to the group administrator email settings: %s in "disable notifications" part of the email
     184    // Link to the group administrator email settings: %s in "disable notifications" part of the email.
    186185    $settings_link  = bp_core_get_user_domain( $admin_id ) . $settings_slug . '/notifications/';
    187186
     
    189188    $membership = new BP_Groups_Member( false, false, $membership_id );
    190189
    191     // Set up and send the message
     190    // Set up and send the message.
    192191    $to       = $ud->user_email;
    193192    $subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group: %s', 'buddypress' ), $group->name ) ) );
     
    225224    }
    226225
    227     // Only show the disable notifications line if the settings component is enabled
     226    // Only show the disable notifications line if the settings component is enabled.
    228227    if ( bp_is_active( 'settings' ) ) {
    229228        $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
     
    289288 * @param bool $accepted           Optional. Whether the membership request was accepted.
    290289 *                                 Default: true.
    291  *
    292290 * @return false|null
    293291 */
    294292function groups_notification_membership_request_completed( $requesting_user_id = 0, $group_id = 0, $accepted = true ) {
    295293
    296     // Trigger a BuddyPress Notification
     294    // Trigger a BuddyPress Notification.
    297295    if ( bp_is_active( 'notifications' ) ) {
    298296
    299         // What type of acknowledgement
     297        // What type of acknowledgement.
    300298        $type = ! empty( $accepted )
    301299            ? 'membership_request_accepted'
     
    310308    }
    311309
    312     // Bail if member opted out of receiving this email
     310    // Bail if member opted out of receiving this email.
    313311    if ( 'no' === bp_get_user_meta( $requesting_user_id, 'notification_membership_request_completed', true ) ) {
    314312        return false;
     
    322320    $to            = $ud->user_email;
    323321
    324     // Set up and send the message
     322    // Set up and send the message.
    325323    if ( ! empty( $accepted ) ) {
    326324        $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group "%s" accepted', 'buddypress' ), $group->name ) ) );
     
    344342    }
    345343
    346     // Only show the disable notifications line if the settings component is enabled
     344    // Only show the disable notifications line if the settings component is enabled.
    347345    if ( bp_is_active( 'settings' ) ) {
    348346        $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
     
    404402 * @param int $user_id  ID of the user.
    405403 * @param int $group_id ID of the group.
    406  *
    407404 * @return false|null False on failure.
    408405 */
     
    418415    }
    419416
    420     // Trigger a BuddyPress Notification
     417    // Trigger a BuddyPress Notification.
    421418    if ( bp_is_active( 'notifications' ) ) {
    422419        bp_notifications_add_notification( array(
     
    428425    }
    429426
    430     // Bail if admin opted out of receiving this email
     427    // Bail if admin opted out of receiving this email.
    431428    if ( 'no' === bp_get_user_meta( $user_id, 'notification_groups_admin_promotion', true ) ) {
    432429        return false;
     
    439436    $settings_link = bp_core_get_user_domain( $user_id ) . $settings_slug . '/notifications/';
    440437
    441     // Set up and send the message
     438    // Set up and send the message.
    442439    $to       = $ud->user_email;
    443440    $subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'You have been promoted in the group: "%s"', 'buddypress' ), $group->name ) ) );
     
    450447', 'buddypress' ), $promoted_to, $group->name, $group_link );
    451448
    452     // Only show the disable notifications line if the settings component is enabled
     449    // Only show the disable notifications line if the settings component is enabled.
    453450    if ( bp_is_active( 'settings' ) ) {
    454451        $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
     
    511508 * @param BP_Groups_Member $member          Member object.
    512509 * @param int              $inviter_user_id ID of the user who sent the invite.
    513  *
    514510 * @return null|false False on failure.
    515511 */
    516512function groups_notification_group_invites( &$group, &$member, $inviter_user_id ) {
    517513
    518     // Bail if member has already been invited
     514    // Bail if member has already been invited.
    519515    if ( ! empty( $member->invite_sent ) ) {
    520516        return;
     
    527523    $group_link   = bp_get_group_permalink( $group );
    528524
    529     // Setup the ID for the invited user
     525    // Setup the ID for the invited user.
    530526    $invited_user_id = $member->user_id;
    531527
    532     // Trigger a BuddyPress Notification
     528    // Trigger a BuddyPress Notification.
    533529    if ( bp_is_active( 'notifications' ) ) {
    534530        bp_notifications_add_notification( array(
     
    540536    }
    541537
    542     // Bail if member opted out of receiving this email
     538    // Bail if member opted out of receiving this email.
    543539    if ( 'no' === bp_get_user_meta( $invited_user_id, 'notification_groups_invite', true ) ) {
    544540        return false;
     
    551547    $invites_link  = trailingslashit( $invited_link . bp_get_groups_slug() . '/invites' );
    552548
    553     // Set up and send the message
     549    // Set up and send the message.
    554550    $to       = $invited_ud->user_email;
    555551    $subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'You have an invitation to the group: "%s"', 'buddypress' ), $group->name ) ) );
     
    566562', 'buddypress' ), $inviter_name, $group->name, $invites_link, $group_link, $inviter_name, $inviter_link );
    567563
    568     // Only show the disable notifications line if the settings component is enabled
     564    // Only show the disable notifications line if the settings component is enabled.
    569565    if ( bp_is_active( 'settings' ) ) {
    570566        $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
     
    634630 * @param string $format            'string' for BuddyBar-compatible notifications; 'array'
    635631 *                                  for WP Toolbar. Default: 'string'.
    636  *
    637632 * @return string
    638633 */
     
    649644
    650645            // Set up the string and the filter
    651             // Because different values are passed to the filters, we'll return the
    652             // values inline
     646            // because different values are passed to the filters,
     647            // we'll return values inline.
    653648            if ( (int) $total_items > 1 ) {
    654649                $text = sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );
     
    12611256function bp_groups_screen_my_groups_mark_notifications() {
    12621257
    1263     // Delete group request notifications for the user
     1258    // Delete group request notifications for the user.
    12641259    if ( isset( $_GET['n'] ) && bp_is_active( 'notifications' ) ) {
    12651260
    1266         // Get the necessary ID's
     1261        // Get the necessary ID's.
    12671262        $group_id = buddypress()->groups->id;
    12681263        $user_id  = bp_loggedin_user_id();
    12691264
    1270         // Mark notifications read
     1265        // Mark notifications read.
    12711266        bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'membership_request_accepted' );
    12721267        bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'membership_request_rejected' );
Note: See TracChangeset for help on using the changeset viewer.