Changeset 12932
- Timestamp:
- 04/29/2021 01:28:50 PM (4 years ago)
- Location:
- trunk/src/bp-core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-functions.php
r12931 r12932 3978 3978 function bp_email_get_type_schema( $field = 'description' ) { 3979 3979 $activity_comment = array( 3980 'description' => __( 'A member has replied to an activity update that the recipient posted.', 'buddypress' ), 3981 'unsubscribe' => array( 3982 'meta_key' => 'notification_activity_new_reply', 3983 'message' => __( 'You will no longer receive emails when someone replies to an update or comment you posted.', 'buddypress' ), 3980 'description' => __( 'A member has replied to an activity update that the recipient posted.', 'buddypress' ), 3981 'named_salutation' => true, 3982 'unsubscribe' => array( 3983 'meta_key' => 'notification_activity_new_reply', 3984 'message' => __( 'You will no longer receive emails when someone replies to an update or comment you posted.', 'buddypress' ), 3984 3985 ), 3985 3986 ); 3986 3987 3987 3988 $activity_comment_author = array( 3988 'description' => __( 'A member has replied to a comment on an activity update that the recipient posted.', 'buddypress' ), 3989 'unsubscribe' => array( 3990 'meta_key' => 'notification_activity_new_reply', 3991 'message' => __( 'You will no longer receive emails when someone replies to an update or comment you posted.', 'buddypress' ), 3989 'description' => __( 'A member has replied to a comment on an activity update that the recipient posted.', 'buddypress' ), 3990 'named_salutation' => true, 3991 'unsubscribe' => array( 3992 'meta_key' => 'notification_activity_new_reply', 3993 'message' => __( 'You will no longer receive emails when someone replies to an update or comment you posted.', 'buddypress' ), 3992 3994 ), 3993 3995 ); 3994 3996 3995 3997 $activity_at_message = array( 3996 'description' => __( 'Recipient was mentioned in an activity update.', 'buddypress' ), 3997 'unsubscribe' => array( 3998 'meta_key' => 'notification_activity_new_mention', 3999 'message' => __( 'You will no longer receive emails when someone mentions you in an update.', 'buddypress' ), 3998 'description' => __( 'Recipient was mentioned in an activity update.', 'buddypress' ), 3999 'named_salutation' => true, 4000 'unsubscribe' => array( 4001 'meta_key' => 'notification_activity_new_mention', 4002 'message' => __( 'You will no longer receive emails when someone mentions you in an update.', 'buddypress' ), 4000 4003 ), 4001 4004 ); 4002 4005 4003 4006 $groups_at_message = array( 4004 'description' => __( 'Recipient was mentioned in a group activity update.', 'buddypress' ), 4005 'unsubscribe' => array( 4006 'meta_key' => 'notification_activity_new_mention', 4007 'message' => __( 'You will no longer receive emails when someone mentions you in an update.', 'buddypress' ), 4007 'description' => __( 'Recipient was mentioned in a group activity update.', 'buddypress' ), 4008 'named_salutation' => true, 4009 'unsubscribe' => array( 4010 'meta_key' => 'notification_activity_new_mention', 4011 'message' => __( 'You will no longer receive emails when someone mentions you in an update.', 'buddypress' ), 4008 4012 ), 4009 4013 ); 4010 4014 4011 4015 $core_user_registration = array( 4012 'description' => __( 'Recipient has registered for an account.', 'buddypress' ), 4013 'unsubscribe' => false, 4016 'description' => __( 'Recipient has registered for an account.', 'buddypress' ), 4017 'named_salutation' => true, 4018 'unsubscribe' => false, 4014 4019 ); 4015 4020 4016 4021 $core_user_registration_with_blog = array( 4017 'description' => __( 'Recipient has registered for an account and site.', 'buddypress' ), 4018 'unsubscribe' => false, 4022 'description' => __( 'Recipient has registered for an account and site.', 'buddypress' ), 4023 'named_salutation' => true, 4024 'unsubscribe' => false, 4019 4025 ); 4020 4026 4021 4027 $friends_request = array( 4022 'description' => __( 'A member has sent a friend request to the recipient.', 'buddypress' ), 4023 'unsubscribe' => array( 4024 'meta_key' => 'notification_friends_friendship_request', 4025 'message' => __( 'You will no longer receive emails when someone sends you a friend request.', 'buddypress' ), 4028 'description' => __( 'A member has sent a friend request to the recipient.', 'buddypress' ), 4029 'named_salutation' => true, 4030 'unsubscribe' => array( 4031 'meta_key' => 'notification_friends_friendship_request', 4032 'message' => __( 'You will no longer receive emails when someone sends you a friend request.', 'buddypress' ), 4026 4033 ), 4027 4034 ); 4028 4035 4029 4036 $friends_request_accepted = array( 4030 'description' => __( 'Recipient has had a friend request accepted by a member.', 'buddypress' ), 4031 'unsubscribe' => array( 4032 'meta_key' => 'notification_friends_friendship_accepted', 4033 'message' => __( 'You will no longer receive emails when someone accepts your friendship request.', 'buddypress' ), 4037 'description' => __( 'Recipient has had a friend request accepted by a member.', 'buddypress' ), 4038 'named_salutation' => true, 4039 'unsubscribe' => array( 4040 'meta_key' => 'notification_friends_friendship_accepted', 4041 'message' => __( 'You will no longer receive emails when someone accepts your friendship request.', 'buddypress' ), 4034 4042 ), 4035 4043 ); 4036 4044 4037 4045 $groups_details_updated = array( 4038 'description' => __( "A group's details were updated.", 'buddypress' ), 4039 'unsubscribe' => array( 4040 'meta_key' => 'notification_groups_group_updated', 4041 'message' => __( 'You will no longer receive emails when one of your groups is updated.', 'buddypress' ), 4046 'description' => __( "A group's details were updated.", 'buddypress' ), 4047 'named_salutation' => true, 4048 'unsubscribe' => array( 4049 'meta_key' => 'notification_groups_group_updated', 4050 'message' => __( 'You will no longer receive emails when one of your groups is updated.', 'buddypress' ), 4042 4051 ), 4043 4052 ); 4044 4053 4045 4054 $groups_invitation = array( 4046 'description' => __( 'A member has sent a group invitation to the recipient.', 'buddypress' ), 4047 'unsubscribe' => array( 4048 'meta_key' => 'notification_groups_invite', 4049 'message' => __( 'You will no longer receive emails when you are invited to join a group.', 'buddypress' ), 4055 'description' => __( 'A member has sent a group invitation to the recipient.', 'buddypress' ), 4056 'named_salutation' => true, 4057 'unsubscribe' => array( 4058 'meta_key' => 'notification_groups_invite', 4059 'message' => __( 'You will no longer receive emails when you are invited to join a group.', 'buddypress' ), 4050 4060 ), 4051 4061 ); 4052 4062 4053 4063 $groups_member_promoted = array( 4054 'description' => __( "Recipient's status within a group has changed.", 'buddypress' ), 4055 'unsubscribe' => array( 4056 'meta_key' => 'notification_groups_admin_promotion', 4057 'message' => __( 'You will no longer receive emails when you have been promoted in a group.', 'buddypress' ), 4064 'description' => __( "Recipient's status within a group has changed.", 'buddypress' ), 4065 'named_salutation' => true, 4066 'unsubscribe' => array( 4067 'meta_key' => 'notification_groups_admin_promotion', 4068 'message' => __( 'You will no longer receive emails when you have been promoted in a group.', 'buddypress' ), 4058 4069 ), 4059 4070 ); 4060 4071 4061 4072 $groups_membership_request = array( 4062 'description' => __( 'A member has requested permission to join a group.', 'buddypress' ), 4063 'unsubscribe' => array( 4064 'meta_key' => 'notification_groups_membership_request', 4065 'message' => __( 'You will no longer receive emails when someone requests to be a member of your group.', 'buddypress' ), 4073 'description' => __( 'A member has requested permission to join a group.', 'buddypress' ), 4074 'named_salutation' => true, 4075 'unsubscribe' => array( 4076 'meta_key' => 'notification_groups_membership_request', 4077 'message' => __( 'You will no longer receive emails when someone requests to be a member of your group.', 'buddypress' ), 4066 4078 ), 4067 4079 ); 4068 4080 4069 4081 $messages_unread = array( 4070 'description' => __( 'Recipient has received a private message.', 'buddypress' ), 4071 'unsubscribe' => array( 4072 'meta_key' => 'notification_messages_new_message', 4073 'message' => __( 'You will no longer receive emails when someone sends you a message.', 'buddypress' ), 4082 'description' => __( 'Recipient has received a private message.', 'buddypress' ), 4083 'named_salutation' => true, 4084 'unsubscribe' => array( 4085 'meta_key' => 'notification_messages_new_message', 4086 'message' => __( 'You will no longer receive emails when someone sends you a message.', 'buddypress' ), 4074 4087 ), 4075 4088 ); 4076 4089 4077 4090 $settings_verify_email_change = array( 4078 'description' => __( 'Recipient has changed their email address.', 'buddypress' ), 4079 'unsubscribe' => false, 4091 'description' => __( 'Recipient has changed their email address.', 'buddypress' ), 4092 'named_salutation' => true, 4093 'unsubscribe' => false, 4080 4094 ); 4081 4095 4082 4096 $groups_membership_request_accepted = array( 4083 'description' => __( 'Recipient had requested to join a group, which was accepted.', 'buddypress' ), 4084 'unsubscribe' => array( 4085 'meta_key' => 'notification_membership_request_completed', 4086 'message' => __( 'You will no longer receive emails when your request to join a group has been accepted or denied.', 'buddypress' ), 4097 'description' => __( 'Recipient had requested to join a group, which was accepted.', 'buddypress' ), 4098 'named_salutation' => true, 4099 'unsubscribe' => array( 4100 'meta_key' => 'notification_membership_request_completed', 4101 'message' => __( 'You will no longer receive emails when your request to join a group has been accepted or denied.', 'buddypress' ), 4087 4102 ), 4088 4103 ); 4089 4104 4090 4105 $groups_membership_request_rejected = array( 4091 'description' => __( 'Recipient had requested to join a group, which was rejected.', 'buddypress' ), 4092 'unsubscribe' => array( 4093 'meta_key' => 'notification_membership_request_completed', 4094 'message' => __( 'You will no longer receive emails when your request to join a group has been accepted or denied.', 'buddypress' ), 4106 'description' => __( 'Recipient had requested to join a group, which was rejected.', 'buddypress' ), 4107 'named_salutation' => true, 4108 'unsubscribe' => array( 4109 'meta_key' => 'notification_membership_request_completed', 4110 'message' => __( 'You will no longer receive emails when your request to join a group has been accepted or denied.', 'buddypress' ), 4095 4111 ), 4096 4112 ); 4097 4113 4098 4114 $core_user_activation = array( 4099 'description' => __( 'Recipient has successfully activated an account.', 'buddypress' ), 4115 'description' => __( 'Recipient has successfully activated an account.', 'buddypress' ), 4116 'named_salutation' => true, 4117 'unsubscribe' => false, 4100 4118 ); 4101 4119 4102 4120 $members_invitation = array( 4103 'description' => __( 'A site member has sent a site invitation to the recipient.', 'buddypress' ), 4104 'unsubscribe' => array( 4105 'meta_key' => 'notification_bp_members_invite', 4106 'message' => __( 'You will no longer receive emails when you are invited to join this site.', 'buddypress' ), 4121 'description' => __( 'A site member has sent a site invitation to the recipient.', 'buddypress' ), 4122 'named_salutation' => false, 4123 'unsubscribe' => array( 4124 'meta_key' => 'notification_bp_members_invite', 4125 'message' => __( 'You will no longer receive emails when you are invited to join this site.', 'buddypress' ), 4107 4126 ), 4108 4127 ); … … 4351 4370 4352 4371 /** 4372 * Gets the BP Email type of a BP Email ID or object. 4373 * 4374 * @since 8.0.0 4375 * 4376 * @param int|WP_Post $email Optional. BP Email ID or BP Email object. Defaults to global $post. 4377 * @return string The type of the BP Email object. 4378 */ 4379 function bp_email_get_type( $email = null ) { 4380 $email = get_post( $email ); 4381 4382 if ( ! $email ) { 4383 return ''; 4384 } 4385 4386 $types = bp_get_object_terms( $email->ID, bp_get_email_tax_type(), array( 'fields' => 'slugs' ) ); 4387 $type = reset( $types ); 4388 4389 return $type; 4390 } 4391 4392 /** 4353 4393 * Get BuddyPress content allowed tags. 4354 4394 * -
trunk/src/bp-core/bp-core-template.php
r12919 r12932 3801 3801 * 3802 3802 * @since 2.5.0 3803 * @since 8.0.0 Checks current BP Email type schema to eventually use the unnamed salutation. 3803 3804 * 3804 3805 * @param array $settings Email Settings. … … 3806 3807 */ 3807 3808 function bp_email_get_salutation( $settings = array() ) { 3808 $token = '{{recipient.name}}'; 3809 3810 /** 3811 * Filters The Recipient Salutation inside the Email Template. 3812 * 3813 * @since 2.5.0 3814 * 3815 * @param string $value The Recipient Salutation. 3816 * @param array $settings Email Settings. 3817 * @param string $token The Recipient token. 3818 */ 3819 return apply_filters( 3820 'bp_email_get_salutation', 3821 sprintf( 3822 /* translators: %s: the email token for the recipient name */ 3823 _x( 'Hi %s,', 'recipient salutation', 'buddypress' ), 3809 $email_type = bp_email_get_type(); 3810 $saluation = ''; 3811 3812 if ( $email_type ) { 3813 $types_schema = bp_email_get_type_schema( 'named_salutation' ); 3814 3815 if ( isset( $types_schema[ $email_type ] ) && false === $types_schema[ $email_type ] ) { 3816 /** 3817 * Filters The Recipient Unnamed Salutation inside the Email Template. 3818 * 3819 * @since 8.0.0 3820 * 3821 * @param string $value The Recipient Salutation. 3822 * @param array $settings Email Settings. 3823 */ 3824 $saluation = apply_filters( 3825 'bp_email_get_unnamed_salutation', 3826 _x( 'Hi,', 'Unnamed recipient salutation', 'buddypress' ), 3827 $settings 3828 ); 3829 } 3830 } 3831 3832 // Named salutations are default. 3833 if ( ! $saluation ) { 3834 $token = '{{recipient.name}}'; 3835 3836 /** 3837 * Filters The Recipient Named Salutation inside the Email Template. 3838 * 3839 * @since 2.5.0 3840 * 3841 * @param string $value The Recipient Salutation. 3842 * @param array $settings Email Settings. 3843 * @param string $token The Recipient token. 3844 */ 3845 $saluation = apply_filters( 3846 'bp_email_get_salutation', 3847 sprintf( 3848 /* translators: %s: the email token for the recipient name */ 3849 _x( 'Hi %s,', 'Named recipient salutation', 'buddypress' ), 3850 $token 3851 ), 3852 $settings, 3824 3853 $token 3825 ) ,3826 $settings,3827 $token 3828 );3829 } 3854 ); 3855 } 3856 3857 return $saluation; 3858 } -
trunk/src/bp-core/classes/class-bp-email.php
r12913 r12932 791 791 add_filter( 'bp_locate_template_and_load', '__return_true' ); 792 792 793 // Set up the `$post` global. 794 global $post; 795 $reset_post = $post; 796 $post = $this->post_object; 797 793 798 bp_locate_template( bp_email_get_template( $this->post_object ), true, false ); 799 800 // Reset the `$post` global. 801 $post = $reset_post; 794 802 795 803 remove_filter( 'bp_locate_template_and_load', '__return_true' );
Note: See TracChangeset
for help on using the changeset viewer.