[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-groups/ -> bp-groups-notifications.php (source)

   1  <?php
   2  /**
   3   * BuddyPress Groups Notification Functions.
   4   *
   5   * These functions handle the recording, deleting and formatting of notifications
   6   * for the user and for this specific component.
   7   *
   8   * @package BuddyPress
   9   * @subpackage GroupsActivity
  10   * @since 1.0.0
  11   */
  12  
  13  // Exit if accessed directly.
  14  defined( 'ABSPATH' ) || exit;
  15  
  16  /** Emails ********************************************************************/
  17  
  18  /**
  19   * Notify all group members when a group is updated.
  20   *
  21   * @since 1.0.0
  22   *
  23   * @param int                  $group_id  ID of the group.
  24   * @param BP_Groups_Group|null $old_group Group before new details were saved.
  25   */
  26  function groups_notification_group_updated( $group_id = 0, $old_group = null ) {
  27      $group = groups_get_group( $group_id );
  28  
  29      if ( $old_group instanceof BP_Groups_Group ) {
  30          $changed = array();
  31  
  32          if ( $group->name !== $old_group->name ) {
  33              $changed[] = sprintf(
  34                  _x( '* Name changed from "%s" to "%s".', 'Group update email text', 'buddypress' ),
  35                  esc_html( $old_group->name ),
  36                  esc_html( $group->name )
  37              );
  38          }
  39  
  40          if ( $group->description !== $old_group->description ) {
  41              $changed[] = sprintf(
  42                  _x( '* Description changed from "%s" to "%s".', 'Group update email text', 'buddypress' ),
  43                  esc_html( $old_group->description ),
  44                  esc_html( $group->description )
  45              );
  46          }
  47  
  48          if ( $group->slug !== $old_group->slug ) {
  49              $changed[] = sprintf(
  50                  _x( '* Permalink changed from "%s" to "%s".', 'Group update email text', 'buddypress' ),
  51                  esc_url( bp_get_group_permalink( $old_group ) ),
  52                  esc_url( bp_get_group_permalink( $group ) )
  53              );
  54          }
  55      }
  56  
  57      /**
  58       * Filters the bullet points listing updated items in the email notification after a group is updated.
  59       *
  60       * @since 2.2.0
  61       *
  62       * @param array $changed Array of bullet points.
  63       */
  64      $changed = apply_filters( 'groups_notification_group_update_updated_items', $changed );
  65  
  66      $changed_text = '';
  67      if ( ! empty( $changed ) ) {
  68          $changed_text = implode( "\n", $changed );
  69      }
  70  
  71      $user_ids = BP_Groups_Member::get_group_member_ids( $group->id );
  72      foreach ( (array) $user_ids as $user_id ) {
  73  
  74          // Continue if member opted out of receiving this email.
  75          if ( 'no' === bp_get_user_meta( $user_id, 'notification_groups_group_updated', true ) ) {
  76              continue;
  77          }
  78  
  79          $unsubscribe_args = array(
  80              'user_id'           => $user_id,
  81              'notification_type' => 'groups-details-updated',
  82          );
  83  
  84          $args = array(
  85              'tokens' => array(
  86                  'changed_text' => $changed_text,
  87                  'group'        => $group,
  88                  'group.id'     => $group_id,
  89                  'group.url'    => esc_url( bp_get_group_permalink( $group ) ),
  90                  'group.name'   => $group->name,
  91                  'unsubscribe'  => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ),
  92              ),
  93          );
  94          bp_send_email( 'groups-details-updated', (int) $user_id, $args );
  95      }
  96  
  97      /**
  98       * Fires after the notification is sent that a group has been updated.
  99       *
 100       * See https://buddypress.trac.wordpress.org/ticket/3644 for blank message parameter.
 101       *
 102       * @since 1.5.0
 103       * @since 2.5.0 $subject has been unset and is deprecated.
 104       *
 105       * @param array  $user_ids Array of user IDs to notify about the update.
 106       * @param string $subject  Deprecated in 2.5; now an empty string.
 107       * @param string $value    Empty string preventing PHP error.
 108       * @param int    $group_id ID of the group that was updated.
 109       */
 110      do_action( 'bp_groups_sent_updated_email', $user_ids, '', '', $group_id );
 111  }
 112  
 113  /**
 114   * Notify group admin about new membership request.
 115   *
 116   * @since 1.0.0
 117   *
 118   * @param int $requesting_user_id ID of the user requesting group membership.
 119   * @param int $admin_id           ID of the group admin.
 120   * @param int $group_id           ID of the group.
 121   * @param int $membership_id      ID of the group membership object.
 122   */
 123  function groups_notification_new_membership_request( $requesting_user_id = 0, $admin_id = 0, $group_id = 0, $membership_id = 0 ) {
 124  
 125      // Trigger a BuddyPress Notification.
 126      if ( bp_is_active( 'notifications' ) ) {
 127          bp_notifications_add_notification( array(
 128              'user_id'           => $admin_id,
 129              'item_id'           => $group_id,
 130              'secondary_item_id' => $requesting_user_id,
 131              'component_name'    => buddypress()->groups->id,
 132              'component_action'  => 'new_membership_request',
 133          ) );
 134      }
 135  
 136      // Bail if member opted out of receiving this email.
 137      if ( 'no' === bp_get_user_meta( $admin_id, 'notification_groups_membership_request', true ) ) {
 138          return;
 139      }
 140  
 141      $unsubscribe_args = array(
 142          'user_id'           => $admin_id,
 143          'notification_type' => 'groups-membership-request',
 144      );
 145  
 146      $group = groups_get_group( $group_id );
 147      $args  = array(
 148          'tokens' => array(
 149              'admin.id'             => $admin_id,
 150              'group'                => $group,
 151              'group.name'           => $group->name,
 152              'group.id'             => $group_id,
 153              'group-requests.url'   => esc_url( bp_get_group_permalink( $group ) . 'admin/membership-requests' ),
 154              'membership.id'        => $membership_id,
 155              'profile.url'          => esc_url( bp_core_get_user_domain( $requesting_user_id ) ),
 156              'requesting-user.id'   => $requesting_user_id,
 157              'requesting-user.name' => bp_core_get_user_displayname( $requesting_user_id ),
 158              'unsubscribe'          => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ),
 159          ),
 160      );
 161      bp_send_email( 'groups-membership-request', (int) $admin_id, $args );
 162  }
 163  
 164  /**
 165   * Notify member about their group membership request.
 166   *
 167   * @since 1.0.0
 168   *
 169   * @param int  $requesting_user_id ID of the user requesting group membership.
 170   * @param int  $group_id           ID of the group.
 171   * @param bool $accepted           Optional. Whether the membership request was accepted.
 172   *                                 Default: true.
 173   */
 174  function groups_notification_membership_request_completed( $requesting_user_id = 0, $group_id = 0, $accepted = true ) {
 175  
 176      // Trigger a BuddyPress Notification.
 177      if ( bp_is_active( 'notifications' ) ) {
 178  
 179          // What type of acknowledgement.
 180          $type = ! empty( $accepted ) ? 'membership_request_accepted' : 'membership_request_rejected';
 181  
 182          bp_notifications_add_notification( array(
 183              'user_id'           => $requesting_user_id,
 184              'item_id'           => $group_id,
 185              'component_name'    => buddypress()->groups->id,
 186              'component_action'  => $type,
 187          ) );
 188      }
 189  
 190      // Bail if member opted out of receiving this email.
 191      if ( 'no' === bp_get_user_meta( $requesting_user_id, 'notification_membership_request_completed', true ) ) {
 192          return;
 193      }
 194  
 195      $group = groups_get_group( $group_id );
 196      $args  = array(
 197          'tokens' => array(
 198              'group'              => $group,
 199              'group.id'           => $group_id,
 200              'group.name'         => $group->name,
 201              'group.url'          => esc_url( bp_get_group_permalink( $group ) ),
 202              'requesting-user.id' => $requesting_user_id,
 203          ),
 204      );
 205  
 206      if ( ! empty( $accepted ) ) {
 207  
 208          $unsubscribe_args = array(
 209              'user_id'           => $requesting_user_id,
 210              'notification_type' => 'groups-membership-request-accepted',
 211          );
 212  
 213          $args['tokens']['unsubscribe'] = esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) );
 214  
 215          bp_send_email( 'groups-membership-request-accepted', (int) $requesting_user_id, $args );
 216  
 217      } else {
 218  
 219          $unsubscribe_args = array(
 220              'user_id'           => $requesting_user_id,
 221              'notification_type' => 'groups-membership-request-rejected',
 222          );
 223  
 224          $args['tokens']['unsubscribe'] = esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) );
 225  
 226          bp_send_email( 'groups-membership-request-rejected', (int) $requesting_user_id, $args );
 227      }
 228  }
 229  add_action( 'groups_membership_accepted', 'groups_notification_membership_request_completed', 10, 3 );
 230  add_action( 'groups_membership_rejected', 'groups_notification_membership_request_completed', 10, 3 );
 231  
 232  /**
 233   * Notify group member they have been promoted.
 234   *
 235   * @since 1.0.0
 236   *
 237   * @param int $user_id  ID of the user.
 238   * @param int $group_id ID of the group.
 239   */
 240  function groups_notification_promoted_member( $user_id = 0, $group_id = 0 ) {
 241  
 242      // What type of promotion is this?
 243      if ( groups_is_user_admin( $user_id, $group_id ) ) {
 244          $promoted_to = __( 'an administrator', 'buddypress' );
 245          $type        = 'member_promoted_to_admin';
 246      } else {
 247          $promoted_to = __( 'a moderator', 'buddypress' );
 248          $type        = 'member_promoted_to_mod';
 249      }
 250  
 251      // Trigger a BuddyPress Notification.
 252      if ( bp_is_active( 'notifications' ) ) {
 253          bp_notifications_add_notification( array(
 254              'user_id'           => $user_id,
 255              'item_id'           => $group_id,
 256              'component_name'    => buddypress()->groups->id,
 257              'component_action'  => $type,
 258          ) );
 259      }
 260  
 261      // Bail if admin opted out of receiving this email.
 262      if ( 'no' === bp_get_user_meta( $user_id, 'notification_groups_admin_promotion', true ) ) {
 263          return;
 264      }
 265  
 266      $unsubscribe_args = array(
 267          'user_id'           => $user_id,
 268          'notification_type' => 'groups-member-promoted',
 269      );
 270  
 271      $group = groups_get_group( $group_id );
 272      $args  = array(
 273          'tokens' => array(
 274              'group'       => $group,
 275              'group.id'    => $group_id,
 276              'group.url'   => esc_url( bp_get_group_permalink( $group ) ),
 277              'group.name'  => $group->name,
 278              'promoted_to' => $promoted_to,
 279              'user.id'     => $user_id,
 280              'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ),
 281          ),
 282      );
 283      bp_send_email( 'groups-member-promoted', (int) $user_id, $args );
 284  }
 285  add_action( 'groups_promoted_member', 'groups_notification_promoted_member', 10, 2 );
 286  
 287  /**
 288   * Notify a member they have been invited to a group.
 289   *
 290   * @since 1.0.0
 291   *
 292   * @param BP_Groups_Group  $group           Group object.
 293   * @param BP_Groups_Member $member          Member object.
 294   * @param int              $inviter_user_id ID of the user who sent the invite.
 295   */
 296  function groups_notification_group_invites( &$group, &$member, $inviter_user_id ) {
 297  
 298      // Bail if member has already been invited.
 299      if ( ! empty( $member->invite_sent ) ) {
 300          return;
 301      }
 302  
 303      // @todo $inviter_ud may be used for caching, test without it
 304      $inviter_ud      = bp_core_get_core_userdata( $inviter_user_id );
 305      $invited_user_id = $member->user_id;
 306  
 307      // Trigger a BuddyPress Notification.
 308      if ( bp_is_active( 'notifications' ) ) {
 309          bp_notifications_add_notification( array(
 310              'user_id'          => $invited_user_id,
 311              'item_id'          => $group->id,
 312              'component_name'   => buddypress()->groups->id,
 313              'component_action' => 'group_invite',
 314          ) );
 315      }
 316  
 317      // Bail if member opted out of receiving this email.
 318      if ( 'no' === bp_get_user_meta( $invited_user_id, 'notification_groups_invite', true ) ) {
 319          return;
 320      }
 321  
 322      $invited_link = bp_core_get_user_domain( $invited_user_id ) . bp_get_groups_slug();
 323  
 324      $unsubscribe_args = array(
 325          'user_id'           => $invited_user_id,
 326          'notification_type' => 'groups-invitation',
 327      );
 328  
 329      $args         = array(
 330          'tokens' => array(
 331              'group'        => $group,
 332              'group.url'    => bp_get_group_permalink( $group ),
 333              'group.name'   => $group->name,
 334              'inviter.name' => bp_core_get_userlink( $inviter_user_id, true, false, true ),
 335              'inviter.url'  => bp_core_get_user_domain( $inviter_user_id ),
 336              'inviter.id'   => $inviter_user_id,
 337              'invites.url'  => esc_url( $invited_link . '/invites/' ),
 338              'unsubscribe'  => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ),
 339          ),
 340      );
 341      bp_send_email( 'groups-invitation', (int) $invited_user_id, $args );
 342  }
 343  
 344  /** Notifications *************************************************************/
 345  
 346  /**
 347   * Format notifications for the Groups component.
 348   *
 349   * @since 1.0.0
 350   *
 351   * @param string $action            The kind of notification being rendered.
 352   * @param int    $item_id           The primary item ID.
 353   * @param int    $secondary_item_id The secondary item ID.
 354   * @param int    $total_items       The total number of messaging-related notifications
 355   *                                  waiting for the user.
 356   * @param string $format            'string' for BuddyBar-compatible notifications; 'array'
 357   *                                  for WP Toolbar. Default: 'string'.
 358   * @return string
 359   */
 360  function groups_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
 361  
 362      switch ( $action ) {
 363          case 'new_membership_request':
 364              $group_id = $item_id;
 365              $requesting_user_id = $secondary_item_id;
 366  
 367              $group = groups_get_group( $group_id );
 368              $group_link = bp_get_group_permalink( $group );
 369              $amount = 'single';
 370  
 371              // Set up the string and the filter
 372              // because different values are passed to the filters,
 373              // we'll return values inline.
 374              if ( (int) $total_items > 1 ) {
 375                  $text = sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );
 376                  $amount = 'multiple';
 377                  $notification_link = $group_link . 'admin/membership-requests/?n=1';
 378  
 379                  if ( 'string' == $format ) {
 380  
 381                      /**
 382                       * Filters groups multiple new membership request notification for string format.
 383                       *
 384                       * This is a dynamic filter that is dependent on item count and action.
 385                       * Complete filter - bp_groups_multiple_new_membership_requests_notification.
 386                       *
 387                       * @since 1.0.0
 388                       *
 389                       * @param string $string            HTML anchor tag for request.
 390                       * @param string $group_link        The permalink for the group.
 391                       * @param int    $total_items       Total number of membership requests.
 392                       * @param string $group->name       Name of the group.
 393                       * @param string $text              Notification content.
 394                       * @param string $notification_link The permalink for notification.
 395                       */
 396                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . 's_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $total_items, $group->name, $text, $notification_link );
 397                  } else {
 398  
 399                      /**
 400                       * Filters groups multiple new membership request notification for any non-string format.
 401                       *
 402                       * This is a dynamic filter that is dependent on item count and action.
 403                       * Complete filter - bp_groups_multiple_new_membership_requests_notification.
 404                       *
 405                       * @since 1.0.0
 406                       *
 407                       * @param array  $array             Array holding permalink and content for notification.
 408                       * @param string $group_link        The permalink for the group.
 409                       * @param int    $total_items       Total number of membership requests.
 410                       * @param string $group->name       Name of the group.
 411                       * @param string $text              Notification content.
 412                       * @param string $notification_link The permalink for notification.
 413                       */
 414                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . 's_notification', array(
 415                          'link' => $notification_link,
 416                          'text' => $text
 417                      ), $group_link, $total_items, $group->name, $text, $notification_link );
 418                  }
 419              } else {
 420                  $user_fullname = bp_core_get_user_displayname( $requesting_user_id );
 421                  $text = sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname );
 422                  $notification_link = $group_link . 'admin/membership-requests/?n=1';
 423  
 424                  if ( 'string' == $format ) {
 425  
 426                      /**
 427                       * Filters groups single new membership request notification for string format.
 428                       *
 429                       * This is a dynamic filter that is dependent on item count and action.
 430                       * Complete filter - bp_groups_single_new_membership_request_notification.
 431                       *
 432                       * @since 1.0.0
 433                       *
 434                       * @param string $string            HTML anchor tag for request.
 435                       * @param string $group_link        The permalink for the group.
 436                       * @param string $user_fullname     Full name of requesting user.
 437                       * @param string $group->name       Name of the group.
 438                       * @param string $text              Notification content.
 439                       * @param string $notification_link The permalink for notification.
 440                       */
 441                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $user_fullname, $group->name, $text, $notification_link );
 442                  } else {
 443  
 444                      /**
 445                       * Filters groups single new membership request notification for any non-string format.
 446                       *
 447                       * This is a dynamic filter that is dependent on item count and action.
 448                       * Complete filter - bp_groups_single_new_membership_request_notification.
 449                       *
 450                       * @since 1.0.0
 451                       *
 452                       * @param array  $array             Array holding permalink and content for notification.
 453                       * @param string $group_link        The permalink for the group.
 454                       * @param string $user_fullname     Full name of requesting user.
 455                       * @param string $group->name       Name of the group.
 456                       * @param string $text              Notification content.
 457                       * @param string $notification_link The permalink for notification.
 458                       */
 459                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
 460                          'link' => $notification_link,
 461                          'text' => $text
 462                      ), $group_link, $user_fullname, $group->name, $text, $notification_link );
 463                  }
 464              }
 465  
 466              break;
 467  
 468          case 'membership_request_accepted':
 469              $group_id = $item_id;
 470  
 471              $group = groups_get_group( $group_id );
 472              $group_link = bp_get_group_permalink( $group );
 473              $amount = 'single';
 474  
 475              if ( (int) $total_items > 1 ) {
 476                  $text = sprintf( __( '%d accepted group membership requests', 'buddypress' ), (int) $total_items, $group->name );
 477                  $amount = 'multiple';
 478                  $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
 479  
 480                  if ( 'string' == $format ) {
 481  
 482                      /**
 483                       * Filters multiple accepted group membership requests notification for string format.
 484                       * Complete filter - bp_groups_multiple_membership_request_accepted_notification.
 485                       *
 486                       * @since 1.0.0
 487                       *
 488                       * @param string $string            HTML anchor tag for notification.
 489                       * @param int    $total_items       Total number of accepted requests.
 490                       * @param string $group->name       Name of the group.
 491                       * @param string $text              Notification content.
 492                       * @param string $notification_link The permalink for notification.
 493                       */
 494                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $group->name, $text, $notification_link );
 495                  } else {
 496  
 497                      /**
 498                       * Filters multiple accepted group membership requests notification for non-string format.
 499                       * Complete filter - bp_groups_multiple_membership_request_accepted_notification.
 500                       *
 501                       * @since 1.0.0
 502                       *
 503                       * @param array  $array             Array holding permalink and content for notification
 504                       * @param int    $total_items       Total number of accepted requests.
 505                       * @param string $group->name       Name of the group.
 506                       * @param string $text              Notification content.
 507                       * @param string $notification_link The permalink for notification.
 508                       */
 509                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
 510                          'link' => $notification_link,
 511                          'text' => $text
 512                      ), $total_items, $group->name, $text, $notification_link );
 513                  }
 514              } else {
 515                  $text = sprintf( __( 'Membership for group "%s" accepted', 'buddypress' ), $group->name );
 516                  $filter = 'bp_groups_single_membership_request_accepted_notification';
 517                  $notification_link = $group_link . '?n=1';
 518  
 519                  if ( 'string' == $format ) {
 520  
 521                      /**
 522                       * Filters single accepted group membership request notification for string format.
 523                       * Complete filter - bp_groups_single_membership_request_accepted_notification.
 524                       *
 525                       * @since 1.0.0
 526                       *
 527                       * @param string $string            HTML anchor tag for notification.
 528                       * @param string $group_link        The permalink for the group.
 529                       * @param string $group->name       Name of the group.
 530                       * @param string $text              Notification content.
 531                       * @param string $notification_link The permalink for notification.
 532                       */
 533                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
 534                  } else {
 535  
 536                      /**
 537                       * Filters single accepted group membership request notification for non-string format.
 538                       * Complete filter - bp_groups_single_membership_request_accepted_notification.
 539                       *
 540                       * @since 1.0.0
 541                       *
 542                       * @param array  $array             Array holding permalink and content for notification.
 543                       * @param string $group_link        The permalink for the group.
 544                       * @param string $group->name       Name of the group.
 545                       * @param string $text              Notification content.
 546                       * @param string $notification_link The permalink for notification.
 547                       */
 548                      return apply_filters( $filter, array(
 549                          'link' => $notification_link,
 550                          'text' => $text
 551                      ), $group_link, $group->name, $text, $notification_link );
 552                  }
 553              }
 554  
 555              break;
 556  
 557          case 'membership_request_rejected':
 558              $group_id = $item_id;
 559  
 560              $group = groups_get_group( $group_id );
 561              $group_link = bp_get_group_permalink( $group );
 562              $amount = 'single';
 563  
 564              if ( (int) $total_items > 1 ) {
 565                  $text = sprintf( __( '%d rejected group membership requests', 'buddypress' ), (int) $total_items, $group->name );
 566                  $amount = 'multiple';
 567                  $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
 568  
 569                  if ( 'string' == $format ) {
 570  
 571                      /**
 572                       * Filters multiple rejected group membership requests notification for string format.
 573                       * Complete filter - bp_groups_multiple_membership_request_rejected_notification.
 574                       *
 575                       * @since 1.0.0
 576                       *
 577                       * @param string $string            HTML anchor tag for notification.
 578                       * @param int    $total_items       Total number of rejected requests.
 579                       * @param string $group->name       Name of the group.
 580                       * @param string $text              Notification content.
 581                       * @param string $notification_link The permalink for notification.
 582                       */
 583                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $group->name );
 584                  } else {
 585  
 586                      /**
 587                       * Filters multiple rejected group membership requests notification for non-string format.
 588                       * Complete filter - bp_groups_multiple_membership_request_rejected_notification.
 589                       *
 590                       * @since 1.0.0
 591                       *
 592                       * @param array  $array             Array holding permalink and content for notification.
 593                       * @param int    $total_items       Total number of rejected requests.
 594                       * @param string $group->name       Name of the group.
 595                       * @param string $text              Notification content.
 596                       * @param string $notification_link The permalink for notification.
 597                       */
 598                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
 599                          'link' => $notification_link,
 600                          'text' => $text
 601                      ), $total_items, $group->name, $text, $notification_link );
 602                  }
 603              } else {
 604                  $text = sprintf( __( 'Membership for group "%s" rejected', 'buddypress' ), $group->name );
 605                  $notification_link = $group_link . '?n=1';
 606  
 607                  if ( 'string' == $format ) {
 608  
 609                      /**
 610                       * Filters single rejected group membership requests notification for string format.
 611                       * Complete filter - bp_groups_single_membership_request_rejected_notification.
 612                       *
 613                       * @since 1.0.0
 614                       *
 615                       * @param string $string            HTML anchor tag for notification.
 616                       * @param int    $group_link        The permalink for the group.
 617                       * @param string $group->name       Name of the group.
 618                       * @param string $text              Notification content.
 619                       * @param string $notification_link The permalink for notification.
 620                       */
 621                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
 622                  } else {
 623  
 624                      /**
 625                       * Filters single rejected group membership requests notification for non-string format.
 626                       * Complete filter - bp_groups_single_membership_request_rejected_notification.
 627                       *
 628                       * @since 1.0.0
 629                       *
 630                       * @param array  $array             Array holding permalink and content for notification.
 631                       * @param int    $group_link        The permalink for the group.
 632                       * @param string $group->name       Name of the group.
 633                       * @param string $text              Notification content.
 634                       * @param string $notification_link The permalink for notification.
 635                       */
 636                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
 637                          'link' => $notification_link,
 638                          'text' => $text
 639                      ), $group_link, $group->name, $text, $notification_link );
 640                  }
 641              }
 642  
 643              break;
 644  
 645          case 'member_promoted_to_admin':
 646              $group_id = $item_id;
 647  
 648              $group = groups_get_group( $group_id );
 649              $group_link = bp_get_group_permalink( $group );
 650              $amount = 'single';
 651  
 652              if ( (int) $total_items > 1 ) {
 653                  $text = sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int) $total_items );
 654                  $amount = 'multiple';
 655                  $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
 656  
 657                  if ( 'string' == $format ) {
 658                      /**
 659                       * Filters multiple promoted to group admin notification for string format.
 660                       * Complete filter - bp_groups_multiple_member_promoted_to_admin_notification.
 661                       *
 662                       * @since 1.0.0
 663                       *
 664                       * @param string $string            HTML anchor tag for notification.
 665                       * @param int    $total_items       Total number of rejected requests.
 666                       * @param string $text              Notification content.
 667                       * @param string $notification_link The permalink for notification.
 668                       */
 669                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $text, $notification_link );
 670                  } else {
 671                      /**
 672                       * Filters multiple promoted to group admin notification for non-string format.
 673                       * Complete filter - bp_groups_multiple_member_promoted_to_admin_notification.
 674                       *
 675                       * @since 1.0.0
 676                       *
 677                       * @param array  $array             Array holding permalink and content for notification.
 678                       * @param int    $total_items       Total number of rejected requests.
 679                       * @param string $text              Notification content.
 680                       * @param string $notification_link The permalink for notification.
 681                       */
 682                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
 683                          'link' => $notification_link,
 684                          'text' => $text
 685                      ), $total_items, $text, $notification_link );
 686                  }
 687              } else {
 688                  $text = sprintf( __( 'You were promoted to an admin in the group "%s"', 'buddypress' ), $group->name );
 689                  $notification_link = $group_link . '?n=1';
 690  
 691                  if ( 'string' == $format ) {
 692                      /**
 693                       * Filters single promoted to group admin notification for non-string format.
 694                       * Complete filter - bp_groups_single_member_promoted_to_admin_notification.
 695                       *
 696                       * @since 1.0.0
 697                       *
 698                       * @param string $string            HTML anchor tag for notification.
 699                       * @param int    $group_link        The permalink for the group.
 700                       * @param string $group->name       Name of the group.
 701                       * @param string $text              Notification content.
 702                       * @param string $notification_link The permalink for notification.
 703                       */
 704                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
 705                  } else {
 706                      /**
 707                       * Filters single promoted to group admin notification for non-string format.
 708                       * Complete filter - bp_groups_single_member_promoted_to_admin_notification.
 709                       *
 710                       * @since 1.0.0
 711                       *
 712                       * @param array  $array             Array holding permalink and content for notification.
 713                       * @param int    $group_link        The permalink for the group.
 714                       * @param string $group->name       Name of the group.
 715                       * @param string $text              Notification content.
 716                       * @param string $notification_link The permalink for notification.
 717                       */
 718                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
 719                          'link' => $notification_link,
 720                          'text' => $text
 721                      ), $group_link, $group->name, $text, $notification_link );
 722                  }
 723              }
 724  
 725              break;
 726  
 727          case 'member_promoted_to_mod':
 728              $group_id = $item_id;
 729  
 730              $group = groups_get_group( $group_id );
 731              $group_link = bp_get_group_permalink( $group );
 732              $amount = 'single';
 733  
 734              if ( (int) $total_items > 1 ) {
 735                  $text = sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int) $total_items );
 736                  $amount = 'multiple';
 737                  $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
 738  
 739                  if ( 'string' == $format ) {
 740                      /**
 741                       * Filters multiple promoted to group mod notification for string format.
 742                       * Complete filter - bp_groups_multiple_member_promoted_to_mod_notification.
 743                       *
 744                       * @since 1.0.0
 745                       *
 746                       * @param string $string            HTML anchor tag for notification.
 747                       * @param int    $total_items       Total number of rejected requests.
 748                       * @param string $text              Notification content.
 749                       * @param string $notification_link The permalink for notification.
 750                       */
 751                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $text, $notification_link );
 752                  } else {
 753                      /**
 754                       * Filters multiple promoted to group mod notification for non-string format.
 755                       * Complete filter - bp_groups_multiple_member_promoted_to_mod_notification.
 756                       *
 757                       * @since 1.0.0
 758                       *
 759                       * @param array  $array             Array holding permalink and content for notification.
 760                       * @param int    $total_items       Total number of rejected requests.
 761                       * @param string $text              Notification content.
 762                       * @param string $notification_link The permalink for notification.
 763                       */
 764                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
 765                          'link' => $notification_link,
 766                          'text' => $text
 767                      ), $total_items, $text, $notification_link );
 768                  }
 769              } else {
 770                  $text = sprintf( __( 'You were promoted to a mod in the group "%s"', 'buddypress' ), $group->name );
 771                  $notification_link = $group_link . '?n=1';
 772  
 773                  if ( 'string' == $format ) {
 774                      /**
 775                       * Filters single promoted to group mod notification for string format.
 776                       * Complete filter - bp_groups_single_member_promoted_to_mod_notification.
 777                       *
 778                       * @since 1.0.0
 779                       *
 780                       * @param string $string            HTML anchor tag for notification.
 781                       * @param int    $group_link        The permalink for the group.
 782                       * @param string $group->name       Name of the group.
 783                       * @param string $text              Notification content.
 784                       * @param string $notification_link The permalink for notification.
 785                       */
 786                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
 787                  } else {
 788                      /**
 789                       * Filters single promoted to group admin notification for non-string format.
 790                       * Complete filter - bp_groups_single_member_promoted_to_mod_notification.
 791                       *
 792                       * @since 1.0.0
 793                       *
 794                       * @param array  $array             Array holding permalink and content for notification.
 795                       * @param int    $group_link        The permalink for the group.
 796                       * @param string $group->name       Name of the group.
 797                       * @param string $text              Notification content.
 798                       * @param string $notification_link The permalink for notification.
 799                       */
 800                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
 801                          'link' => $notification_link,
 802                          'text' => $text
 803                      ), $group_link, $group->name, $text, $notification_link );
 804                  }
 805              }
 806  
 807              break;
 808  
 809          case 'group_invite':
 810              $group_id = $item_id;
 811              $group = groups_get_group( $group_id );
 812              $group_link = bp_get_group_permalink( $group );
 813              $amount = 'single';
 814  
 815              $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/?n=1';
 816  
 817              if ( (int) $total_items > 1 ) {
 818                  $text = sprintf( __( 'You have %d new group invitations', 'buddypress' ), (int) $total_items );
 819                  $amount = 'multiple';
 820  
 821                  if ( 'string' == $format ) {
 822                      /**
 823                       * Filters multiple group invitation notification for string format.
 824                       * Complete filter - bp_groups_multiple_group_invite_notification.
 825                       *
 826                       * @since 1.0.0
 827                       *
 828                       * @param string $string            HTML anchor tag for notification.
 829                       * @param int    $total_items       Total number of rejected requests.
 830                       * @param string $text              Notification content.
 831                       * @param string $notification_link The permalink for notification.
 832                       */
 833                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $text, $notification_link );
 834                  } else {
 835                      /**
 836                       * Filters multiple group invitation notification for non-string format.
 837                       * Complete filter - bp_groups_multiple_group_invite_notification.
 838                       *
 839                       * @since 1.0.0
 840                       *
 841                       * @param array  $array             Array holding permalink and content for notification.
 842                       * @param int    $total_items       Total number of rejected requests.
 843                       * @param string $text              Notification content.
 844                       * @param string $notification_link The permalink for notification.
 845                       */
 846                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
 847                          'link' => $notification_link,
 848                          'text' => $text
 849                      ), $total_items, $text, $notification_link );
 850                  }
 851              } else {
 852                  $text = sprintf( __( 'You have an invitation to the group: %s', 'buddypress' ), $group->name );
 853                  $filter = 'bp_groups_single_group_invite_notification';
 854  
 855                  if ( 'string' == $format ) {
 856                      /**
 857                       * Filters single group invitation notification for string format.
 858                       * Complete filter - bp_groups_single_group_invite_notification.
 859                       *
 860                       * @since 1.0.0
 861                       *
 862                       * @param string $string            HTML anchor tag for notification.
 863                       * @param int    $group_link        The permalink for the group.
 864                       * @param string $group->name       Name of the group.
 865                       * @param string $text              Notification content.
 866                       * @param string $notification_link The permalink for notification.
 867                       */
 868                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
 869                  } else {
 870                      /**
 871                       * Filters single group invitation notification for non-string format.
 872                       * Complete filter - bp_groups_single_group_invite_notification.
 873                       *
 874                       * @since 1.0.0
 875                       *
 876                       * @param array  $array             Array holding permalink and content for notification.
 877                       * @param int    $group_link        The permalink for the group.
 878                       * @param string $group->name       Name of the group.
 879                       * @param string $text              Notification content.
 880                       * @param string $notification_link The permalink for notification.
 881                       */
 882                      return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
 883                          'link' => $notification_link,
 884                          'text' => $text
 885                      ), $group_link, $group->name, $text, $notification_link );
 886                  }
 887              }
 888  
 889              break;
 890  
 891          default:
 892  
 893              /**
 894               * Filters plugin-added group-related custom component_actions.
 895               *
 896               * @since 2.4.0
 897               *
 898               * @param string $notification      Null value.
 899               * @param int    $item_id           The primary item ID.
 900               * @param int    $secondary_item_id The secondary item ID.
 901               * @param int    $total_items       The total number of messaging-related notifications
 902               *                                  waiting for the user.
 903               * @param string $format            'string' for BuddyBar-compatible notifications;
 904               *                                  'array' for WP Toolbar.
 905               */
 906              $custom_action_notification = apply_filters( 'bp_groups_' . $action . '_notification', null, $item_id, $secondary_item_id, $total_items, $format );
 907  
 908              if ( ! is_null( $custom_action_notification ) ) {
 909                  return $custom_action_notification;
 910              }
 911  
 912              break;
 913      }
 914  
 915      /**
 916       * Fires right before returning the formatted group notifications.
 917       *
 918       * @since 1.0.0
 919       *
 920       * @param string $action            The type of notification being rendered.
 921       * @param int    $item_id           The primary item ID.
 922       * @param int    $secondary_item_id The secondary item ID.
 923       * @param int    $total_items       Total amount of items to format.
 924       */
 925      do_action( 'groups_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
 926  
 927      return false;
 928  }
 929  
 930  /**
 931   * Remove all notifications for any member belonging to a specific group.
 932   *
 933   * @since 1.9.0
 934   *
 935   * @param int $group_id ID of the group.
 936   */
 937  function bp_groups_delete_group_delete_all_notifications( $group_id ) {
 938      if ( bp_is_active( 'notifications' ) ) {
 939          bp_notifications_delete_all_notifications_by_type( $group_id, buddypress()->groups->id );
 940      }
 941  }
 942  add_action( 'groups_delete_group', 'bp_groups_delete_group_delete_all_notifications', 10 );
 943  
 944  /**
 945   * When a demotion takes place, delete any corresponding promotion notifications.
 946   *
 947   * @since 2.0.0
 948   *
 949   * @param int $user_id  ID of the user.
 950   * @param int $group_id ID of the group.
 951   */
 952  function bp_groups_delete_promotion_notifications( $user_id = 0, $group_id = 0 ) {
 953      if ( bp_is_active( 'notifications' ) && ! empty( $group_id ) && ! empty( $user_id ) ) {
 954          bp_notifications_delete_notifications_by_item_id( $user_id, $group_id, buddypress()->groups->id, 'member_promoted_to_admin' );
 955          bp_notifications_delete_notifications_by_item_id( $user_id, $group_id, buddypress()->groups->id, 'member_promoted_to_mod' );
 956      }
 957  }
 958  add_action( 'groups_demoted_member', 'bp_groups_delete_promotion_notifications', 10, 2 );
 959  
 960  /**
 961   * Mark notifications read when a member accepts a group invitation.
 962   *
 963   * @since 1.9.0
 964   *
 965   * @param int $user_id  ID of the user.
 966   * @param int $group_id ID of the group.
 967   */
 968  function bp_groups_accept_invite_mark_notifications( $user_id, $group_id ) {
 969      if ( bp_is_active( 'notifications' ) ) {
 970          bp_notifications_mark_notifications_by_item_id( $user_id, $group_id, buddypress()->groups->id, 'group_invite' );
 971      }
 972  }
 973  add_action( 'groups_accept_invite', 'bp_groups_accept_invite_mark_notifications', 10, 2 );
 974  add_action( 'groups_reject_invite', 'bp_groups_accept_invite_mark_notifications', 10, 2 );
 975  add_action( 'groups_delete_invite', 'bp_groups_accept_invite_mark_notifications', 10, 2 );
 976  
 977  /**
 978   * Mark notifications read when a member's group membership request is granted.
 979   *
 980   * @since 2.8.0
 981   *
 982   * @param int $user_id  ID of the user.
 983   * @param int $group_id ID of the group.
 984   */
 985  function bp_groups_accept_request_mark_notifications( $user_id, $group_id ) {
 986      if ( bp_is_active( 'notifications' ) ) {
 987          // First null parameter marks read for all admins.
 988          bp_notifications_mark_notifications_by_item_id( null, $group_id, buddypress()->groups->id, 'new_membership_request', $user_id );
 989      }
 990  }
 991  add_action( 'groups_membership_accepted', 'bp_groups_accept_request_mark_notifications', 10, 2 );
 992  add_action( 'groups_membership_rejected', 'bp_groups_accept_request_mark_notifications', 10, 2 );
 993  
 994  /**
 995   * Mark notifications read when a member views their group memberships.
 996   *
 997   * @since 1.9.0
 998   */
 999  function bp_groups_screen_my_groups_mark_notifications() {
1000  
1001      // Delete group request notifications for the user.
1002      if ( isset( $_GET['n'] ) && bp_is_active( 'notifications' ) ) {
1003  
1004          // Get the necessary ID's.
1005          $group_id = buddypress()->groups->id;
1006          $user_id  = bp_loggedin_user_id();
1007  
1008          // Mark notifications read.
1009          bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'membership_request_accepted' );
1010          bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'membership_request_rejected' );
1011          bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'member_promoted_to_mod'      );
1012          bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'member_promoted_to_admin'    );
1013      }
1014  }
1015  add_action( 'groups_screen_my_groups',  'bp_groups_screen_my_groups_mark_notifications', 10 );
1016  add_action( 'groups_screen_group_home', 'bp_groups_screen_my_groups_mark_notifications', 10 );
1017  
1018  /**
1019   * Mark group invitation notifications read when a member views their invitations.
1020   *
1021   * @since 1.9.0
1022   */
1023  function bp_groups_screen_invites_mark_notifications() {
1024      if ( bp_is_active( 'notifications' ) ) {
1025          bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->groups->id, 'group_invite' );
1026      }
1027  }
1028  add_action( 'groups_screen_group_invites', 'bp_groups_screen_invites_mark_notifications', 10 );
1029  
1030  /**
1031   * Mark group join requests read when an admin or moderator visits the group administration area.
1032   *
1033   * @since 1.9.0
1034   */
1035  function bp_groups_screen_group_admin_requests_mark_notifications() {
1036      if ( bp_is_active( 'notifications' ) ) {
1037          bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->groups->id, 'new_membership_request' );
1038      }
1039  }
1040  add_action( 'groups_screen_group_admin_requests', 'bp_groups_screen_group_admin_requests_mark_notifications', 10 );
1041  
1042  /**
1043   * Delete new group membership notifications when a user is being deleted.
1044   *
1045   * @since 1.9.0
1046   *
1047   * @param int $user_id ID of the user.
1048   */
1049  function bp_groups_remove_data_for_user_notifications( $user_id ) {
1050      if ( bp_is_active( 'notifications' ) ) {
1051          bp_notifications_delete_notifications_from_user( $user_id, buddypress()->groups->id, 'new_membership_request' );
1052      }
1053  }
1054  add_action( 'groups_remove_data_for_user', 'bp_groups_remove_data_for_user_notifications', 10 );
1055  
1056  /**
1057   * Render the group settings fields on the Notification Settings page.
1058   *
1059   * @since 1.0.0
1060   */
1061  function groups_screen_notification_settings() {
1062  
1063      if ( !$group_invite = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_invite', true ) )
1064          $group_invite  = 'yes';
1065  
1066      if ( !$group_update = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_group_updated', true ) )
1067          $group_update  = 'yes';
1068  
1069      if ( !$group_promo = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_admin_promotion', true ) )
1070          $group_promo   = 'yes';
1071  
1072      if ( !$group_request = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_membership_request', true ) )
1073          $group_request = 'yes';
1074  
1075      if ( ! $group_request_completed = bp_get_user_meta( bp_displayed_user_id(), 'notification_membership_request_completed', true ) ) {
1076          $group_request_completed = 'yes';
1077      }
1078      ?>
1079  
1080      <table class="notification-settings" id="groups-notification-settings">
1081          <thead>
1082              <tr>
1083                  <th class="icon"></th>
1084                  <th class="title"><?php _ex( 'Groups', 'Group settings on notification settings page', 'buddypress' ) ?></th>
1085                  <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
1086                  <th class="no"><?php _e( 'No', 'buddypress' )?></th>
1087              </tr>
1088          </thead>
1089  
1090          <tbody>
1091              <tr id="groups-notification-settings-invitation">
1092                  <td></td>
1093                  <td><?php _ex( 'A member invites you to join a group', 'group settings on notification settings page','buddypress' ) ?></td>
1094                  <td class="yes"><input type="radio" name="notifications[notification_groups_invite]" id="notification-groups-invite-yes" value="yes" <?php checked( $group_invite, 'yes', true ) ?>/><label for="notification-groups-invite-yes" class="bp-screen-reader-text"><?php
1095                      /* translators: accessibility text */
1096                      _e( 'Yes, send email', 'buddypress' );
1097                  ?></label></td>
1098                  <td class="no"><input type="radio" name="notifications[notification_groups_invite]" id="notification-groups-invite-no" value="no" <?php checked( $group_invite, 'no', true ) ?>/><label for="notification-groups-invite-no" class="bp-screen-reader-text"><?php
1099                      /* translators: accessibility text */
1100                      _e( 'No, do not send email', 'buddypress' );
1101                  ?></label></td>
1102              </tr>
1103              <tr id="groups-notification-settings-info-updated">
1104                  <td></td>
1105                  <td><?php _ex( 'Group information is updated', 'group settings on notification settings page', 'buddypress' ) ?></td>
1106                  <td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" id="notification-groups-group-updated-yes" value="yes" <?php checked( $group_update, 'yes', true ) ?>/><label for="notification-groups-group-updated-yes" class="bp-screen-reader-text"><?php
1107                      /* translators: accessibility text */
1108                      _e( 'Yes, send email', 'buddypress' );
1109                  ?></label></td>
1110                  <td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" id="notification-groups-group-updated-no" value="no" <?php checked( $group_update, 'no', true ) ?>/><label for="notification-groups-group-updated-no" class="bp-screen-reader-text"><?php
1111                      /* translators: accessibility text */
1112                      _e( 'No, do not send email', 'buddypress' );
1113                  ?></label></td>
1114              </tr>
1115              <tr id="groups-notification-settings-promoted">
1116                  <td></td>
1117                  <td><?php _ex( 'You are promoted to a group administrator or moderator', 'group settings on notification settings page', 'buddypress' ) ?></td>
1118                  <td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" id="notification-groups-admin-promotion-yes" value="yes" <?php checked( $group_promo, 'yes', true ) ?>/><label for="notification-groups-admin-promotion-yes" class="bp-screen-reader-text"><?php
1119                      /* translators: accessibility text */
1120                      _e( 'Yes, send email', 'buddypress' );
1121                  ?></label></td>
1122                  <td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" id="notification-groups-admin-promotion-no" value="no" <?php checked( $group_promo, 'no', true ) ?>/><label for="notification-groups-admin-promotion-no" class="bp-screen-reader-text"><?php
1123                      /* translators: accessibility text */
1124                      _e( 'No, do not send email', 'buddypress' );
1125                  ?></label></td>
1126              </tr>
1127              <tr id="groups-notification-settings-request">
1128                  <td></td>
1129                  <td><?php _ex( 'A member requests to join a private group for which you are an admin', 'group settings on notification settings page', 'buddypress' ) ?></td>
1130                  <td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" id="notification-groups-membership-request-yes" value="yes" <?php checked( $group_request, 'yes', true ) ?>/><label for="notification-groups-membership-request-yes" class="bp-screen-reader-text"><?php
1131                      /* translators: accessibility text */
1132                      _e( 'Yes, send email', 'buddypress' );
1133                  ?></label></td>
1134                  <td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" id="notification-groups-membership-request-no" value="no" <?php checked( $group_request, 'no', true ) ?>/><label for="notification-groups-membership-request-no" class="bp-screen-reader-text"><?php
1135                      /* translators: accessibility text */
1136                      _e( 'No, do not send email', 'buddypress' );
1137                  ?></label></td>
1138              </tr>
1139              <tr id="groups-notification-settings-request-completed">
1140                  <td></td>
1141                  <td><?php _ex( 'Your request to join a group has been approved or denied', 'group settings on notification settings page', 'buddypress' ) ?></td>
1142                  <td class="yes"><input type="radio" name="notifications[notification_membership_request_completed]" id="notification-groups-membership-request-completed-yes" value="yes" <?php checked( $group_request_completed, 'yes', true ) ?>/><label for="notification-groups-membership-request-completed-yes" class="bp-screen-reader-text"><?php
1143                      /* translators: accessibility text */
1144                      _e( 'Yes, send email', 'buddypress' );
1145                  ?></label></td>
1146                  <td class="no"><input type="radio" name="notifications[notification_membership_request_completed]" id="notification-groups-membership-request-completed-no" value="no" <?php checked( $group_request_completed, 'no', true ) ?>/><label for="notification-groups-membership-request-completed-no" class="bp-screen-reader-text"><?php
1147                      /* translators: accessibility text */
1148                      _e( 'No, do not send email', 'buddypress' );
1149                  ?></label></td>
1150              </tr>
1151  
1152              <?php
1153  
1154              /**
1155               * Fires at the end of the available group settings fields on Notification Settings page.
1156               *
1157               * @since 1.0.0
1158               */
1159              do_action( 'groups_screen_notification_settings' ); ?>
1160  
1161          </tbody>
1162      </table>
1163  
1164  <?php
1165  }
1166  add_action( 'bp_notification_settings', 'groups_screen_notification_settings' );


Generated: Wed Jul 24 01:01:43 2019 Cross-referenced by PHPXref 0.7.1