[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/deprecated/ -> 2.5.php (source)

   1  <?php
   2  /**
   3   * Deprecated functions.
   4   *
   5   * @deprecated 2.5.0
   6   */
   7  
   8  // Exit if accessed directly.
   9  defined( 'ABSPATH' ) || exit;
  10  
  11  /**
  12   * Set "From" name in outgoing email to the site name.
  13   *
  14   * @since 1.0.0
  15   * @deprecated 2.5.0 Not used. Was hooked to WordPress' "wp_mail_from_name" action.
  16   *                   Use the "bp_email_get_from" action instead.
  17   *
  18   * @return string The blog name for the root blog.
  19   */
  20  function bp_core_email_from_name_filter() {
  21      _deprecated_function( __FUNCTION__, '2.5' );
  22  
  23      /**
  24       * Filters the "From" name in outgoing email to the site name.
  25       *
  26       * @since 1.2.0
  27       * @deprecated 2.5.0 Not used.
  28       *
  29       * @param string $value Value to set the "From" name to.
  30       */
  31      return apply_filters( 'bp_core_email_from_name_filter', bp_get_option( 'blogname', 'WordPress' ) );
  32  }
  33  
  34  /**
  35   * Add support for pre-2.5 email filters.
  36   *
  37   * @since 2.5.0
  38   *
  39   * @param mixed $value
  40   * @param string $property Name of property.
  41   * @param string $transform Return value transformation. Unused.
  42   * @param BP_Email $email Email object reference.
  43   * @return mixed
  44   */
  45  function bp_core_deprecated_email_filters( $value, $property, $transform, $email ) {
  46      $pre_2_5_emails = array(
  47          'activity-at-message',
  48          'activity-comment',
  49          'activity-comment-author',
  50          'core-user-registration',
  51          'core-user-registration-with-blog',
  52          'friends-request',
  53          'friends-request-accepted',
  54          'groups-at-message',
  55          'groups-details-updated',
  56          'groups-invitation',
  57          'groups-member-promoted',
  58          'groups-membership-request',
  59          'groups-membership-request-accepted',
  60          'groups-membership-request-rejected',
  61          'messages-unread',
  62          'settings-verify-email-change',
  63      );
  64  
  65      remove_filter( 'bp_email_get_property', 'bp_core_deprecated_email_filters', 20 );
  66      $email_type = $email->get( 'type' );
  67      $tokens     = $email->get( 'tokens' );
  68      add_filter( 'bp_email_get_property', 'bp_core_deprecated_email_filters', 20, 4 );
  69  
  70      // Backpat for pre-2.5 emails only.
  71      if ( ! in_array( $email_type, $pre_2_5_emails, true ) ) {
  72          return $value;
  73      }
  74  
  75      $original_value = $value;
  76      $to_changed     = false;
  77  
  78      if ( $property === 'to' && $original_value ) {
  79          $to_changed     = true;
  80  
  81          $value          = array_shift( $original_value );
  82          $recipient_name = $value->get_name();     // Value - name
  83          $value          = $value->get_address();  // Key   - email
  84      }
  85  
  86      if ( $email_type === 'activity-comment' ) {
  87          if ( $property === 'to' ) {
  88              /**
  89               * Filters the user email that the new comment notification will be sent to.
  90               *
  91               * @since 1.2.0
  92               * @deprecated 2.5.0 Use the filters in BP_Email.
  93               *
  94               * @param string $value
  95               */
  96              $value = apply_filters( 'bp_activity_new_comment_notification_to', $value );
  97  
  98          } elseif ( $property === 'subject' ) {
  99              /**
 100               * Filters the new comment notification subject that will be sent to user.
 101               *
 102               * @since 1.2.0
 103               * @deprecated 2.5.0 Use the filters in BP_Email.
 104               *
 105               * @param string $value       Email notification subject text.
 106               * @param string $poster_name Name of the person who made the comment.
 107               */
 108              $value = apply_filters( 'bp_activity_new_comment_notification_subject', $value, $tokens['poster.name'] );
 109  
 110          } elseif ( $property === 'content' ) {
 111              /**
 112               * Filters the new comment notification message that will be sent to user.
 113               *
 114               * @since 1.2.0
 115               * @deprecated 2.5.0 Use the filters in BP_Email. $settings_link argument unset and deprecated.
 116               *
 117               * @param string $value         Email notification message text.
 118               * @param string $poster_name   Name of the person who made the comment.
 119               * @param string $content       Content of the comment.
 120               * @param string $thread_link   URL permalink for the activity thread.
 121               * @param string $deprecated    Removed in 2.5; now an empty string.
 122               */
 123              $value = apply_filters( 'bp_activity_new_comment_notification_message', $value, $tokens['poster.name'], $tokens['content'], $tokens['thread.url'], '' );
 124          }
 125  
 126      } elseif ( $email_type === 'activity-comment-author' ) {
 127          if ( $property === 'to' ) {
 128              /**
 129               * Filters the user email that the new comment reply notification will be sent to.
 130               *
 131               * @since 1.2.0
 132               * @deprecated 2.5.0 Use the filters in BP_Email.
 133               *
 134               * @param string $value
 135               */
 136              $value = apply_filters( 'bp_activity_new_comment_notification_comment_author_to', $value );
 137  
 138          } elseif ( $property === 'subject' ) {
 139              /**
 140               * Filters the new comment reply notification subject that will be sent to user.
 141               *
 142               * @since 1.2.0
 143               * @deprecated 2.5.0 Use the filters in BP_Email.
 144               *
 145               * @param string $value       Email notification subject text.
 146               * @param string $poster_name Name of the person who made the comment.
 147               */
 148              $value = apply_filters( 'bp_activity_new_comment_notification_comment_author_subject', $value, $tokens['poster.name'] );
 149  
 150          } elseif ( $property === 'content' ) {
 151              /**
 152               * Filters the new comment reply notification message that will be sent to user.
 153               *
 154               * @since 1.2.0
 155               * @deprecated 2.5.0 Use the filters in BP_Email. $settings_link argument unset and deprecated.
 156               *
 157               * @param string $value         Email notification message text.
 158               * @param string $poster_name   Name of the person who made the comment.
 159               * @param string $content       Content of the comment.
 160               * @param string $deprecated    Removed in 2.5; now an empty string.
 161               * @param string $thread_link   URL permalink for the activity thread.
 162               */
 163              $value = apply_filters( 'bp_activity_new_comment_notification_comment_author_message', $value, $tokens['poster.name'], $tokens['content'], '', $tokens['thread.url'] );
 164          }
 165  
 166      } elseif ( $email_type === 'activity-at-message' || $email_type === 'groups-at-message' ) {
 167          if ( $property === 'to' ) {
 168              /**
 169               * Filters the user email that the @mention notification will be sent to.
 170               *
 171               * @since 1.2.0
 172               * @deprecated 2.5.0 Use the filters in BP_Email.
 173               *
 174               * @param string $value
 175               */
 176              $value = apply_filters( 'bp_activity_at_message_notification_to', $value );
 177  
 178          } elseif ( $property === 'subject' ) {
 179              /**
 180               * Filters the @mention notification subject that will be sent to user.
 181               *
 182               * @since 1.2.0
 183               * @deprecated 2.5.0 Use the filters in BP_Email.
 184               *
 185               * @param string $value       Email notification subject text.
 186               * @param string $poster_name Name of the person who made the @mention.
 187               */
 188              $value = apply_filters( 'bp_activity_at_message_notification_subject', $value, $tokens['poster.name'] );
 189  
 190          } elseif ( $property === 'content' ) {
 191              /**
 192               * Filters the @mention notification message that will be sent to user.
 193               *
 194               * @since 1.2.0
 195               * @deprecated 2.5.0 Use the filters in BP_Email. $settings_link argument unset and deprecated.
 196               *
 197               * @param string $message       Email notification message text.
 198               * @param string $poster_name   Name of the person who made the @mention.
 199               * @param string $content       Content of the @mention.
 200               * @param string $message_link  URL permalink for the activity message.
 201               * @param string $deprecated    Removed in 2.5; now an empty string.
 202               */
 203              $value = apply_filters( 'bp_activity_at_message_notification_message', $value, $tokens['poster.name'], $tokens['content'], $tokens['mentioned.url'], '' );
 204          }
 205  
 206      } elseif ( $email_type === 'core-user-registration' ) {
 207          // Filters are different according to the WordPress config.
 208          if ( is_multisite() ) {
 209              $registration_filters = array(
 210                  'to'      => 'bp_core_activation_signup_user_notification_to',
 211                  'subject' => 'bp_core_activation_signup_user_notification_subject',
 212                  'content' => 'bp_core_activation_signup_user_notification_message',
 213              );
 214          } else {
 215              $registration_filters = array(
 216                  'to'      => 'bp_core_signup_send_validation_email_to',
 217                  'subject' => 'bp_core_signup_send_validation_email_subject',
 218                  'content' => 'bp_core_signup_send_validation_email_message',
 219              );
 220          }
 221  
 222          if ( $property === 'to' ) {
 223              /**
 224               * Filters the email that the notification is going to upon successful registration without blog.
 225               *
 226               * @since 1.2.0
 227               * @deprecated 2.5.0 Use the filters in BP_Email. $meta argument unset and deprecated.
 228               *
 229               * @param string $value              User email the notification is being sent to.
 230               * @param string $recipient_username The user's login name.
 231               * @param array $value               User email the notification is being sent to (again).
 232               *                                   Array key is email address, value is the name.
 233               * @param string $key                The activation key created in wpmu_signup_blog().
 234               * @param array $meta                Removed in 2.5; now an empty array.
 235               */
 236              $value = apply_filters( $registration_filters['to'], $value, $tokens['recipient.username'], $value, $tokens['key'], array() );
 237  
 238          } elseif ( $property === 'subject' ) {
 239              /**
 240               * Filters the subject that the notification uses upon successful registration without blog.
 241               *
 242               * @since 1.2.0
 243               * @deprecated 2.5.0 Use the filters in BP_Email. $meta argument unset and deprecated.
 244               *
 245               * @param string $value              Email notification subject text.
 246               * @param string $recipient_username The user's login name.
 247               * @param string $recipient_email    The user's email address.
 248               * @param string $key                The activation key created in wpmu_signup_blog().
 249               * @param array $meta                Removed in 2.5; now an empty array.
 250               */
 251              $value = apply_filters( $registration_filters['subject'], $value, $tokens['recipient.username'], $tokens['recipient.email'], $tokens['key'], array() );
 252  
 253          } elseif ( $property === 'content' ) {
 254              /**
 255               * Filters the message that the notification uses upon successful registration without blog.
 256               *
 257               * @since 1.2.0
 258               * @deprecated 2.5.0 Use the filters in BP_Email. $meta argument unset and deprecated.
 259               *
 260               * @param string $value              The message to use.
 261               * @param string $recipient_username The user's login name.
 262               * @param string $recipient_email    The user's email address.
 263               * @param string $key                The activation key created in wpmu_signup_blog().
 264               * @param array $meta                Removed in 2.5; now an empty array.
 265               */
 266              $value = apply_filters( $registration_filters['content'], $value, $tokens['recipient.username'], $tokens['recipient.email'], $tokens['key'], array() );
 267          }
 268  
 269      } elseif ( $email_type === 'core-user-registration-with-blog' ) {
 270          if ( $property === 'to' ) {
 271              /**
 272               * Filters the email that the notification is going to upon successful registration with blog.
 273               *
 274               * @since 1.2.0
 275               * @deprecated 2.5.0 Use the filters in BP_Email. $meta argument unset and deprecated.
 276               *
 277               * @param string $value              User email the notification is being sent to.
 278               * @param string $domain             The new blog domain.
 279               * @param string $path               The new blog path.
 280               * @param string $title              The site title.
 281               * @param string $recipient_username The user's login name.
 282               * @param string $recipient_email    The user's email address.
 283               * @param string $key                The activation key created in wpmu_signup_blog().
 284               * @param array  $meta               Removed in 2.5; now an empty array.
 285               */
 286              $value = apply_filters( 'bp_core_activation_signup_blog_notification_to', $value, $tokens['domain'], $tokens['path'], $tokens['title'], $tokens['recipient.username'], $tokens['recipient.email'], $tokens['key_blog'], array() );
 287  
 288          } elseif ( $property === 'subject' ) {
 289              /**
 290               * Filters the subject that the notification uses upon successful registration with blog.
 291               *
 292               * @since 1.2.0
 293               * @deprecated 2.5.0 Use the filters in BP_Email. $meta argument unset and deprecated.
 294               *
 295               * @param string $value              The subject to use.
 296               * @param string $domain             The new blog domain.
 297               * @param string $path               The new blog path.
 298               * @param string $title              The site title.
 299               * @param string $recipient_username The user's login name.
 300               * @param string $recipient_email    The user's email address.
 301               * @param string $key                The activation key created in wpmu_signup_blog().
 302               * @param array  $meta               Removed in 2.5; now an empty array.
 303               */
 304              $value = apply_filters( 'bp_core_activation_signup_blog_notification_subject', $value, $tokens['domain'], $tokens['path'], $tokens['title'], $tokens['recipient.username'], $tokens['recipient.email'], $tokens['key_blog'], array() );
 305  
 306          } elseif ( $property === 'content' ) {
 307              /**
 308               * Filters the message that the notification uses upon successful registration with blog.
 309               *
 310               * @since 1.2.0
 311               * @deprecated 2.5.0 Use the filters in BP_Email. $meta argument unset and deprecated.
 312               *
 313               * @param string $value              The message to use.
 314               * @param string $domain             The new blog domain.
 315               * @param string $path               The new blog path.
 316               * @param string $title              The site title.
 317               * @param string $recipient_username The user's login name.
 318               * @param string $recipient_email    The user's email address.
 319               * @param string $key                The activation key created in wpmu_signup_blog().
 320               * @param array  $meta               Removed in 2.5; now an empty array.
 321               */
 322              $value = apply_filters( 'bp_core_activation_signup_blog_notification_message', $value, $tokens['domain'], $tokens['path'], $tokens['title'], $tokens['recipient.username'], $tokens['recipient.email'], $tokens['key_blog'], array() );
 323          }
 324  
 325      } elseif ( $email_type === 'friends-request' ) {
 326          if ( $property === 'to' ) {
 327              /**
 328               * Filters the email address for who is getting the friend request.
 329               *
 330               * @since 1.2.0
 331               * @deprecated 2.5.0 Use the filters in BP_Email.
 332               *
 333               * @param string $value
 334               */
 335              $value = apply_filters( 'friends_notification_new_request_to', $value );
 336  
 337          } elseif ( $property === 'subject' ) {
 338              /**
 339               * Filters the subject for the friend request email.
 340               *
 341               * @since 1.2.0
 342               * @deprecated 2.5.0 Use the filters in BP_Email.
 343               *
 344               * @param string $value          Subject line to be used in friend request email.
 345               * @param string $initiator_name Name of the person requesting friendship.
 346               */
 347              $value = apply_filters( 'friends_notification_new_request_subject', $value, $tokens['initiator.name'] );
 348  
 349          } elseif ( $property === 'content' ) {
 350              /**
 351               * Filters the message for the friend request email.
 352               *
 353               * @since 1.2.0
 354               * @deprecated 2.5.0 Use the filters in BP_Email. $settings_link argument unset and deprecated.
 355               *
 356               * @param string $value             Message to be used in friend request email.
 357               * @param string $initiator_name    Name of the person requesting friendship.
 358               * @param string $initiator_link    Profile link of person requesting friendship.
 359               * @param string $all_requests_link User's friends request management link.
 360               * @param string $settings_link     Removed in 2.5; now an empty string.
 361               */
 362              $value = apply_filters( 'friends_notification_new_request_message', $value, $tokens['initiator.name'], $tokens['initiator.url'], $tokens['friend-requests.url'], '' );
 363          }
 364  
 365      } elseif ( $email_type === 'friends-request-accepted' ) {
 366          if ( $property === 'to' ) {
 367              /**
 368               * Filters the email address for whose friend request got accepted.
 369               *
 370               * @since 1.2.0
 371               * @deprecated 2.5.0 Use the filters in BP_Email.
 372               *
 373               * @param string $value Email address for whose friend request got accepted.
 374               */
 375              $value = apply_filters( 'friends_notification_accepted_request_to', $value );
 376  
 377          } elseif ( $property === 'subject' ) {
 378              /**
 379               * Filters the subject for the friend request accepted email.
 380               *
 381               * @since 1.2.0
 382               * @deprecated 2.5.0 Use the filters in BP_Email.
 383               *
 384               * @param string $value       Subject line to be used in friend request accepted email.
 385               * @param string $friend_name Name of the person who accepted the friendship request.
 386               */
 387              $value = apply_filters( 'friends_notification_accepted_request_subject', $value, $tokens['friend.name'] );
 388  
 389          } elseif ( $property === 'content' ) {
 390              /**
 391               * Filters the message for the friend request accepted email.
 392               *
 393               * @since 1.2.0
 394               * @deprecated 2.5.0 Use the filters in BP_Email. $settings_link argument unset and deprecated.
 395               *
 396               * @param string $value         Message to be used in friend request email.
 397               * @param string $friend_name   Name of the person who accepted the friendship request.
 398               * @param string $friend_link   Profile link of person who accepted the friendship request.
 399               * @param string $settings_link Removed in 2.5; now an empty string.
 400               */
 401              $value = apply_filters( 'friends_notification_accepted_request_message', $value, $tokens['friend.name'], $tokens['friendship.url'], '' );
 402          }
 403  
 404      } elseif ( $email_type === 'groups-details-updated' ) {
 405          if ( $property === 'to' ) {
 406              /**
 407               * Filters the user email that the group update notification will be sent to.
 408               *
 409               * @since 1.2.0
 410               * @deprecated 2.5.0 Use the filters in BP_Email.
 411               *
 412               * @param string $value User email the notification is being sent to.
 413               */
 414              $value = apply_filters( 'groups_notification_group_updated_to', $value );
 415  
 416          } elseif ( $property === 'subject' ) {
 417              /**
 418               * Filters the group update notification subject that will be sent to user.
 419               *
 420               * @since 1.2.0
 421               * @deprecated 2.5.0 Use the filters in BP_Email.
 422               *
 423               * @param string          $value Email notification subject text.
 424               * @param BP_Groups_Group $group Object holding the current group instance. Passed by reference.
 425               */
 426              $value = apply_filters_ref_array( 'groups_notification_group_updated_subject', array( $value, &$tokens['group'] ) );
 427  
 428          } elseif ( $property === 'content' ) {
 429              /**
 430               * Filters the group update notification message that will be sent to user.
 431               *
 432               * @since 1.2.0
 433               * @deprecated 2.5.0 Use the filters in BP_Email. $settings_link argument unset and deprecated.
 434               *
 435               * @param string          $value         Email notification message text.
 436               * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
 437               * @param string          $group_link    URL permalink to the group that was updated.
 438               * @param string          $settings_link Removed in 2.5; now an empty string.
 439               */
 440              $value = apply_filters_ref_array( 'groups_notification_group_updated_message', array( $value, &$tokens['group'], $tokens['group.url'], '' ) );
 441          }
 442  
 443      } elseif ( $email_type === 'groups-invitation' ) {
 444          if ( $property === 'to' ) {
 445              /**
 446               * Filters the user email that the group invite notification will be sent to.
 447               *
 448               * @since 1.2.0
 449               * @deprecated 2.5.0 Use the filters in BP_Email.
 450               *
 451               * @param string $value User email the invite notification is being sent to.
 452               */
 453              $value = apply_filters( 'groups_notification_group_invites_to', $value );
 454  
 455          } elseif ( $property === 'subject' ) {
 456              /**
 457               * Filters the group invite notification subject that will be sent to user.
 458               *
 459               * @since 1.2.0
 460               * @deprecated 2.5.0 Use the filters in BP_Email.
 461               *
 462               * @param string          $value Invite notification email subject text.
 463               * @param BP_Groups_Group $group Object holding the current group instance. Passed by reference.
 464               */
 465              $value = apply_filters_ref_array( 'groups_notification_group_invites_subject', array( $value, &$tokens['group'] ) );
 466  
 467          } elseif ( $property === 'content' ) {
 468              /**
 469               * Filters the group invite notification message that will be sent to user.
 470               *
 471               * @since 1.2.0
 472               * @deprecated 2.5.0 Use the filters in BP_Email. $settings_link argument unset and deprecated.
 473               *
 474               * @param string          $value         Invite notification email message text.
 475               * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
 476               * @param string          $inviter_name  Username for the person doing the inviting.
 477               * @param string          $inviter_link  Profile link for the person doing the inviting.
 478               * @param string          $invites_link  URL permalink for the invited user's invite management screen.
 479               * @param string          $group_link    URL permalink for the group that the invite was related to.
 480               * @param string          $settings_link Removed in 2.5; now an empty string.
 481               */
 482              $value = apply_filters_ref_array( 'groups_notification_group_invites_message', array( $value, &$tokens['group'], $tokens['inviter.name'], $tokens['inviter.url'], $tokens['invites.url'], $tokens['group.url'], '' ) );
 483          }
 484  
 485      } elseif ( $email_type === 'groups-member-promoted' ) {
 486          if ( $property === 'to' ) {
 487              /**
 488               * Filters the user email that the group promotion notification will be sent to.
 489               *
 490               * @since 1.2.0
 491               * @deprecated 2.5.0 Use the filters in BP_Email.
 492               *
 493               * @param string $value User email the promotion notification is being sent to.
 494               */
 495              $value = apply_filters( 'groups_notification_promoted_member_to', $value );
 496  
 497          } elseif ( $property === 'subject' ) {
 498              /**
 499               * Filters the group promotion notification subject that will be sent to user.
 500               *
 501               * @since 1.2.0
 502               * @deprecated 2.5.0 Use the filters in BP_Email.
 503               *
 504               * @param string          $value Promotion notification email subject text.
 505               * @param BP_Groups_Group $group Object holding the current group instance. Passed by reference.
 506               */
 507              $value = apply_filters_ref_array( 'groups_notification_promoted_member_subject', array( $value, &$tokens['group'] ) );
 508  
 509          } elseif ( $property === 'content' ) {
 510              /**
 511               * Filters the group promotion notification message that will be sent to user.
 512               *
 513               * @since 1.2.0
 514               * @deprecated 2.5.0 Use the filters in BP_Email. $settings_link argument unset and deprecated.
 515               *
 516               * @param string          $value         Promotion notification email message text.
 517               * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
 518               * @param string          $promoted_to   Role that the user was promoted to within the group.
 519               * @param string          $group_link    URL permalink for the group that the promotion was related to.
 520               * @param string          $settings_link Removed in 2.5; now an empty string.
 521               */
 522              $value = apply_filters_ref_array( 'groups_notification_promoted_member_message', array( $value, &$tokens['group'], $tokens['promoted_to'], $tokens['group.url'], '' ) );
 523          }
 524  
 525      } elseif ( $email_type === 'groups-membership-request' ) {
 526          if ( $property === 'to' ) {
 527              /**
 528               * Filters the user email that the group membership request will be sent to.
 529               *
 530               * @since 1.2.0
 531               * @deprecated 2.5.0 Use the filters in BP_Email.
 532               *
 533               * @param string $value User email the request is being sent to.
 534               */
 535              $value = apply_filters( 'groups_notification_new_membership_request_to', $value );
 536  
 537          } elseif ( $property === 'subject' ) {
 538              /**
 539               * Filters the group membership request subject that will be sent to user.
 540               *
 541               * @since 1.2.0
 542               * @deprecated 2.5.0 Use the filters in BP_Email.
 543               *
 544               * @param string          $value Membership request email subject text.
 545               * @param BP_Groups_Group $group Object holding the current group instance. Passed by reference.
 546               */
 547              $value = apply_filters_ref_array( 'groups_notification_new_membership_request_subject', array( $value, &$tokens['group'] ) );
 548  
 549          } elseif ( $property === 'content' ) {
 550              /**
 551               * Filters the group membership request message that will be sent to user.
 552               *
 553               * @since 1.2.0
 554               * @deprecated 2.5.0 Use the filters in BP_Email. $settings_link argument unset and deprecated.
 555               *
 556               * @param string          $value                Membership request email message text.
 557               * @param BP_Groups_Group $group                Object holding the current group instance. Passed by reference.
 558               * @param string          $requesting_user_name Username of who is requesting membership.
 559               * @param string          $profile_link         URL permalink for the profile for the user requesting membership.
 560               * @param string          $group_requests       URL permalink for the group requests screen for group being requested membership to.
 561               * @param string          $deprecated           Removed in 2.5; now an empty string.
 562               */
 563              $value = apply_filters_ref_array( 'groups_notification_new_membership_request_message', array( $value, &$tokens['group'], $tokens['requesting-user.name'], $tokens['profile.url'], $tokens['group-requests.url'], '' ) );
 564          }
 565  
 566      } elseif ( $email_type === 'groups-membership-request-accepted' || $email_type === 'groups-membership-request-rejected' ) {
 567          if ( $property === 'to' ) {
 568              /**
 569               * Filters the user email that the group membership request result will be sent to.
 570               *
 571               * @deprecated 2.5.0 Use the filters in BP_Email.
 572               *
 573               * @param string $value User email the request is being sent to.
 574               */
 575              $value = apply_filters( 'groups_notification_membership_request_completed_to', $value );
 576  
 577          } elseif ( $property === 'subject' ) {
 578              /**
 579               * Filters the group membership request result subject that will be sent to user.
 580               *
 581               * @since 1.2.0
 582               * @deprecated 2.5.0 Use the filters in BP_Email.
 583               *
 584               * @param string          $value Membership request result email subject text.
 585               * @param BP_Groups_Group $group Object holding the current group instance. Passed by reference.
 586               */
 587              $value = apply_filters_ref_array( 'groups_notification_membership_request_completed_subject', array( $value, &$tokens['group'] ) );
 588  
 589          } elseif ( $property === 'content' ) {
 590              /**
 591               * Filters the group membership request result message that will be sent to user.
 592               *
 593               * @since 1.2.0
 594               * @deprecated 2.5.0 Use the filters in BP_Email. $settings_link argument unset and deprecated.
 595               *
 596               * @param string          $value      Membership request result email message text.
 597               * @param BP_Groups_Group $group      Object holding the current group instance. Passed by reference.
 598               * @param string          $group_link URL permalink for the group that was requested membership for.
 599               * @param string          $deprecated Removed in 2.5; now an empty string.
 600               */
 601              $value = apply_filters_ref_array( 'groups_notification_membership_request_completed_message', array( $value, &$tokens['group'], $tokens['group.url'], '' ) );
 602          }
 603  
 604      } elseif ( $email_type === 'messages-unread' ) {
 605          if ( $property === 'to' ) {
 606              /**
 607               * Filters the user email that the message notification will be sent to.
 608               *
 609               * @since 1.2.0
 610               * @deprecated 2.5.0 Use the filters in BP_Email. $ud argument unset and deprecated.
 611               *
 612               * @param string $value      User email the message notification is being sent to.
 613               * @param bool   $deprecated Removed in 2.5; now a bool (false).
 614               */
 615              $value = apply_filters( 'messages_notification_new_message_to', $value, false );
 616  
 617          } elseif ( $property === 'subject' ) {
 618              /**
 619               * Filters the message notification subject that will be sent to user.
 620               *
 621               * @since 1.2.0
 622               * @deprecated 2.5.0 Use the filters in BP_Email. $ud argument unset and deprecated.
 623               *
 624               * @param string $value       Email notification subject text.
 625               * @param string $sender_name Name of the person who sent the message.
 626               * @param bool   $deprecated  Removed in 2.5; now a bool (false).
 627               */
 628              $value = apply_filters( 'messages_notification_new_message_subject', $value, $tokens['sender.name'], false );
 629  
 630          } elseif ( $property === 'content' ) {
 631              /**
 632               * Filters the message notification message that will be sent to user.
 633               *
 634               * @since 1.2.0
 635               * @deprecated 2.5.0 Use the filters in BP_Email.
 636               *                   $settings_link and $ud arguments unset and deprecated.
 637               *
 638               * @param string $value        Email notification message text.
 639               * @param string $sender_name  Name of the person who sent the message.
 640               * @param string $usersubjec   Email notification subject text.
 641               * @param string $content      Content of the message.
 642               * @param string $message_link URL permalink for the message.
 643               * @param string $deprecated   Removed in 2.5; now an empty string.
 644               * @param bool   $deprecated   Removed in 2.5; now a bool (false).
 645               */
 646              $value = apply_filters( 'messages_notification_new_message_message', $value, $tokens['sender.name'], $tokens['usersubject'], $tokens['content'], $tokens['message.url'], '', false );
 647          }
 648  
 649      } elseif ( $email_type === 'settings-verify-email-change' ) {
 650          if ( $property === 'content' ) {
 651              /**
 652               * Filter the email text sent when a user changes emails.
 653               *
 654               * @since 2.1.0
 655               * @deprecated 2.5.0 Use the filters in BP_Email. $update_user argument unset and deprecated.
 656               *
 657               * @param string  $value           Text of the email.
 658               * @param string  $recipient_email New user email that the current user has changed to.
 659               * @param string  $old_user_email  Existing email address for the current user.
 660               * @param bool    $deprecated      Removed in 2.5; now a bool (false).
 661               */
 662              $value = apply_filters( 'bp_new_user_email_content', $value, $tokens['recipient.email'], $tokens['old-user.email'], false );
 663          }
 664      }
 665  
 666      if ( $property === 'to' && $to_changed ) {
 667          // We normally apart $to, so we often need to rebuild it.
 668          array_unshift( $original_value, new BP_Email_Recipient( $value, $recipient_name ) );
 669          $value = $original_value;
 670      }
 671  
 672      return $value;
 673  }
 674  add_filter( 'bp_email_get_property', 'bp_core_deprecated_email_filters', 20, 4 );
 675  
 676  /**
 677   * Add support for pre-2.5 email actions.
 678   *
 679   * @since 2.5.0
 680   *
 681   * @param bool|WP_Error $delivery_status Bool if the email was sent or not.
 682   *                                       If a WP_Error, there was a failure.
 683   * @param BP_Email $email Email object reference.
 684   * @return mixed
 685   */
 686  function bp_core_deprecated_email_actions( $delivery_status, $email ) {
 687      $pre_2_5_emails = array(
 688          'activity-comment',
 689          'activity-comment-author',
 690          'core-user-registration',
 691          'core-user-registration-with-blog',
 692          'friends-request',
 693          'friends-request-accepted',
 694          'groups-details-updated',
 695          'groups-invitation',
 696          'groups-member-promoted',
 697          'groups-membership-request',
 698          'groups-membership-request-accepted',
 699          'groups-membership-request-rejected',
 700          'messages-unread',
 701          'settings-verify-email-change',
 702      );
 703  
 704      remove_action( 'bp_send_email_success', 'bp_core_deprecated_email_actions', 20 );
 705      $email_content = $email->get( 'content' );
 706      $email_subject = $email->get( 'subject' );
 707      $email_type    = $email->get( 'type' );
 708      $tokens        = $email->get( 'tokens' );
 709      add_action( 'bp_send_email_success', 'bp_core_deprecated_email_actions', 20, 2 );
 710  
 711      // Backpat for pre-2.5 emails only.
 712      if ( ! in_array( $email_type, $pre_2_5_emails, true ) ) {
 713          return;
 714      }
 715  
 716      if ( $email_type === 'activity-comment' ) {
 717          /**
 718           * Fires after the sending of a reply to an update email notification.
 719           *
 720           * @since 1.5.0
 721           * @deprecated 2.5.0 Use the filters in BP_Email. $params argument unset and deprecated.
 722           *
 723           * @param int    $user_id       ID of the original activity item author.
 724           * @param string $email_subject Email notification subject text.
 725           * @param string $email_content Email notification message text.
 726           * @param int    $comment_id    ID for the newly received comment.
 727           * @param int    $commenter_id  ID of the user who made the comment.
 728           * @param array  $deprecated    Removed in 2.5; now an empty array.
 729           */
 730          do_action( 'bp_activity_sent_reply_to_update_email', $tokens['original_activity.user_id'], $email_subject, $email_content, $tokens['comment.id'], $tokens['commenter.id'], array() );
 731  
 732      } elseif ( $email_type === 'activity-comment-author' ) {
 733          /**
 734           * Fires after the sending of a reply to a reply email notification.
 735           *
 736           * @since 1.5.0
 737           * @deprecated 2.5.0 Use the filters in BP_Email. $params argument unset and deprecated.
 738           *
 739           * @param int    $user_id       ID of the parent activity item author.
 740           * @param string $email_subject Email notification subject text.
 741           * @param string $email_content Email notification message text.
 742           * @param int    $comment_id    ID for the newly received comment.
 743           * @param int    $commenter_id  ID of the user who made the comment.
 744           * @param array  $deprecated    Removed in 2.5; now an empty array.
 745           */
 746          do_action( 'bp_activity_sent_reply_to_reply_email', $tokens['parent-comment-user.id'], $email_subject, $email_content, $tokens['comment.id'], $tokens['commenter.id'], array() );
 747  
 748      } elseif ( $email_type === 'core-user-registration' ) {
 749          if ( ! empty( $tokens['user.id'] ) ) {
 750              /**
 751               * Fires after the sending of activation email to a newly registered user.
 752               *
 753               * @since 1.5.0
 754               *
 755               * @param string $email_subject   Subject for the sent email.
 756               * @param string $email_content   Message for the sent email.
 757               * @param int    $user_id         ID of the new user.
 758               * @param string $recipient_email Email address of the new user.
 759               * @param string $key             Activation key.
 760               */
 761              do_action( 'bp_core_sent_user_validation_email', $email_subject, $email_content, $tokens['user.id'], $tokens['recipient.email'], $tokens['key'] );
 762  
 763          } else {
 764              /**
 765               * Fires after the sending of the notification to new users for successful registration without blog.
 766               *
 767               * @since 1.5.0
 768               * @deprecated 2.5.0 Use the filters in BP_Email. $meta argument unset and deprecated.
 769               *
 770               * @param string $admin_email        Admin Email address for the site.
 771               * @param string $email_subject      Subject used in the notification email.
 772               * @param string $email_content      Message used in the notification email.
 773               * @param string $recipient_username The user's login name.
 774               * @param string $recipient_email    The user's email address.
 775               * @param string $key                The activation key created in wpmu_signup_blog().
 776               * @param array  $meta               Removed in 2.5; now an empty array.
 777               */
 778              do_action( 'bp_core_sent_user_signup_email', bp_get_option( 'admin_email' ), $email_subject, $email_content, $tokens['recipient.username'], $tokens['recipient.email'], $tokens['key'], array() );
 779          }
 780  
 781      } elseif ( $email_type === 'core-user-registration-with-blog' ) {
 782          /**
 783           * Fires after the sending of the notification to new users for successful registration with blog.
 784           *
 785           * @since 1.5.0
 786           * @deprecated 2.5.0 Use the filters in BP_Email. $meta argument unset and deprecated.
 787           *
 788           * @param string $admin_email        Admin Email address for the site.
 789           * @param string $email_subject      Subject used in the notification email.
 790           * @param string $email_content      Message used in the notification email.
 791           * @param string $domain             The new blog domain.
 792           * @param string $path               The new blog path.
 793           * @param string $title              The site title.
 794           * @param string $recipient_username The user's login name.
 795           * @param string $recipient_email    The user's email address.
 796           * @param string $key                The activation key created in wpmu_signup_blog().
 797           * @param array  $meta               Removed in 2.5; now an empty array.
 798           */
 799          do_action( 'bp_core_sent_blog_signup_email', bp_get_option( 'admin_email' ), $email_subject, $email_content, $tokens['domain'], $tokens['path'], $tokens['title'], $tokens['recipient.username'], $tokens['recipient.email'], $tokens['key_blog'], array() );
 800  
 801      } elseif ( $email_type === 'friends-request' ) {
 802          /**
 803           * Fires after the new friend request email is sent.
 804           *
 805           * @since 1.5.0
 806           * @deprecated 2.5.0 Use the filters in BP_Email.
 807           *
 808           * @param int    $friend_id     ID of the request recipient.
 809           * @param string $email_subject Text for the friend request subject field.
 810           * @param string $email_content Text for the friend request message field.
 811           * @param int    $friendship_id ID of the friendship object.
 812           * @param int    $initiator_id  ID of the friendship requester.
 813           */
 814          do_action( 'bp_friends_sent_request_email', $tokens['friend.id'], $email_subject, $email_content, $tokens['friendship.id'], $tokens['initiator.id'] );
 815  
 816      } elseif ( $email_type === 'friends-request-accepted' ) {
 817          /**
 818           * Fires after the friend request accepted email is sent.
 819           *
 820           * @since 1.5.0
 821           * @deprecated 2.5.0 Use the filters in BP_Email.
 822           *
 823           * @param int    $initiator_id  ID of the friendship requester.
 824           * @param string $email_subject Text for the friend request subject field.
 825           * @param string $email_content Text for the friend request message field.
 826           * @param int    $friendship_id ID of the friendship object.
 827           * @param int    $friend_id     ID of the request recipient.
 828           */
 829          do_action( 'bp_friends_sent_accepted_email', $tokens['initiator.id'], $email_subject, $email_content, $tokens['friendship.id'], $tokens['friend.id'] );
 830  
 831      } elseif ( $email_type === 'groups-invitation' ) {
 832          /**
 833           * Fires after the notification is sent that a member has been invited to a group.
 834           *
 835           * @since 1.5.0
 836           * @deprecated 2.5.0 Use the filters in BP_Email.
 837           *
 838           * @param int             $invited_user_id  ID of the user who was invited.
 839           * @param string          $email_subject    Email notification subject text.
 840           * @param string          $email_content    Email notification message text.
 841           * @param BP_Groups_Group $group            Group object.
 842           */
 843          do_action( 'bp_groups_sent_invited_email', $tokens['inviter.id'], $email_subject, $email_content, $tokens['group'] );
 844  
 845      } elseif ( $email_type === 'groups-member-promoted' ) {
 846          /**
 847           * Fires after the notification is sent that a member has been promoted.
 848           *
 849           * @since 1.5.0
 850           * @deprecated 2.5.0 Use the filters in BP_Email.
 851           *
 852           * @param int    $user_id       ID of the user who was promoted.
 853           * @param string $email_subject Email notification subject text.
 854           * @param string $email_content Email notification message text.
 855           * @param int    $group_id      ID of the group that the user is a member of.
 856           */
 857          do_action( 'bp_groups_sent_promoted_email', $tokens['user.id'], $email_subject, $email_content, $tokens['group.id'] );
 858  
 859      } elseif ( $email_type === 'groups-membership-request' ) {
 860          /**
 861           * Fires after the notification is sent that a member has requested group membership.
 862           *
 863           * @since 1.5.0
 864           * @deprecated 2.5.0 Use the filters in BP_Email.
 865           *
 866           * @param int    $admin_id           ID of the group administrator.
 867           * @param string $email_subject      Email notification subject text.
 868           * @param string $email_content      Email notification message text.
 869           * @param int    $requesting_user_id ID of the user requesting membership.
 870           * @param int    $group_id           ID of the group receiving membership request.
 871           * @param int    $membership_id      ID of the group membership object.
 872           */
 873          do_action( 'bp_groups_sent_membership_request_email', $tokens['admin.id'], $email_subject, $email_content, $tokens['requesting-user.id'], $tokens['group.id'], $tokens['membership.id'] );
 874  
 875      } elseif ( $email_type === 'groups-membership-request-accepted' || $email_type === 'groups-membership-request-rejected' ) {
 876          /**
 877           * Fires after the notification is sent that a membership has been approved.
 878           *
 879           * @since 1.5.0
 880           * @deprecated 2.5.0 Use the filters in BP_Email.
 881           *
 882           * @param int    $requesting_user_id ID of the user whose membership was approved.
 883           * @param string $email_subject      Email notification subject text.
 884           * @param string $email_content      Email notification message text.
 885           * @param int    $group_id           ID of the group that was joined.
 886           */
 887          do_action( 'bp_groups_sent_membership_approved_email', $tokens['requesting-user.id'], $email_subject, $email_content, $tokens['group.id'] );
 888      }
 889  }
 890  add_action( 'bp_send_email_success', 'bp_core_deprecated_email_actions', 20, 2 );
 891  
 892  /**
 893   * When a blog comment status transition occurs, update the relevant activity's status.
 894   *
 895   * @since 1.6.0
 896   * @deprecated 2.5.0
 897   *
 898   * @param string $new_status New comment status.
 899   * @param string $old_status Previous comment status.
 900   * @param object $comment Comment data.
 901   */
 902  function bp_blogs_transition_activity_status( $new_status, $old_status, $comment ) {
 903      _deprecated_function( __FUNCTION__, '2.5.0', 'bp_activity_transition_post_type_comment_status()' );
 904      bp_activity_transition_post_type_comment_status( $new_status, $old_status, $comment );
 905  }
 906  
 907  /**
 908   * Record a new blog comment in the BuddyPress activity stream.
 909   *
 910   * Only posts the item if blog is public and post is not password-protected.
 911   *
 912   * @deprecated 2.5.0
 913   *
 914   * @param int $comment_id ID of the comment being recorded.
 915   * @param bool|string $is_approved Optional. The $is_approved value passed to
 916   *        the 'comment_post' action. Default: true.
 917   * @return bool|object|null Returns false on failure, the comment object on success.
 918   */
 919  function bp_blogs_record_comment( $comment_id, $is_approved = true ) {
 920      _deprecated_function( __FUNCTION__, '2.5.0', 'bp_activity_post_type_comment()' );
 921      bp_activity_post_type_comment( $comment_id, $is_approved );
 922  }
 923  
 924  /**
 925   * Remove a blog comment activity item from the activity stream.
 926   *
 927   * @deprecated 2.5.0
 928   *
 929   * @param int $comment_id ID of the comment to be removed.
 930   */
 931  function bp_blogs_remove_comment( $comment_id ) {
 932      _deprecated_function( __FUNCTION__, '2.5.0', 'bp_activity_post_type_remove_comment()' );
 933      bp_activity_post_type_remove_comment( $comment_id );
 934  }


Generated: Mon Oct 21 01:01:35 2019 Cross-referenced by PHPXref 0.7.1