/bp-core/deprecated/2.5.php

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