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


Generated: Tue Dec 10 01:01:39 2019 Cross-referenced by PHPXref 0.7.1