Ticket #6915: 6915.01.patch
File 6915.01.patch, 4.5 KB (added by , 9 years ago) |
---|
-
src/bp-core/bp-core-functions.php
2772 2772 * @since 2.5.0 2773 2773 * 2774 2774 * @param string $email_type Unique identifier for a particular type of email. 2775 * @param array $r { 2776 * Array of extra parameters. 2777 * @type string $to Required. The email address of the email recipient. 2778 * } 2775 2779 * @return BP_Email|WP_Error BP_Email object, or WP_Error if there was a problem. 2776 2780 */ 2777 function bp_get_email( $email_type ) {2781 function bp_get_email( $email_type, $r = array() ) { 2778 2782 $switched = false; 2779 2783 2780 2784 // Switch to the root blog, where the email posts live. … … 2830 2834 $post = apply_filters( 'bp_get_email_post', $post[0], $email_type, $args, $post ); 2831 2835 $email = new BP_Email( $email_type ); 2832 2836 2837 // Set the 'To:' email address if passed. 2838 if ( ! empty( $r['to'] ) ) { 2839 $email->set_to( $r['to'] ); 2840 } 2833 2841 2834 2842 /* 2835 2843 * Set some email properties for convenience. … … 2907 2915 * Build the email. 2908 2916 */ 2909 2917 2910 $email = bp_get_email( $email_type ); 2918 $email = bp_get_email( $email_type, array( 2919 'to' => $to 2920 ) ); 2921 2911 2922 if ( is_wp_error( $email ) ) { 2912 2923 return $email; 2913 2924 } 2914 2925 2915 2926 // From, subject, content are set automatically. 2916 $email->set_to( $to );2917 2927 $email->set_tokens( $args['tokens'] ); 2918 2928 2919 2929 $status = $email->validate(); … … 3064 3074 } 3065 3075 3066 3076 /** 3077 * Check if the email is being sent to a singular user. 3078 * 3079 * Meant to be used inside email templates only. 3080 * 3081 * @since 2.5.0 3082 */ 3083 function bp_email_is_recipient_to_singular_user() { 3084 if ( empty( buddypress()->core->email->to ) ) { 3085 return false; 3086 } 3087 3088 $to = buddypress()->core->email->to; 3089 3090 // More than one user in the 'To:' field, so bail! 3091 if ( isset( $to[1] ) ) { 3092 return false; 3093 } 3094 3095 $user_id = email_exists( $to[0]->get_address() ); 3096 if ( ! empty( $user_id ) && bp_is_user_active( $user_id ) ) { 3097 return true; 3098 } else { 3099 return false; 3100 } 3101 } 3102 3103 /** 3067 3104 * Replace all tokens in the input text with appropriate values. 3068 3105 * 3069 3106 * Intended for use with the email system introduced in BuddyPress 2.5.0. -
src/bp-core/classes/class-bp-email.php
732 732 ->set_content_html( $this->post_object->post_content ) 733 733 ->set_content_plaintext( $this->post_object->post_excerpt ); 734 734 735 // Stash some variables so we can check them in the email template. 736 buddypress()->core->email = new stdClass; 737 buddypress()->core->email->to = $this->get_to(); 738 735 739 ob_start(); 736 740 737 741 // Load the template. … … 744 748 $this->set_template( ob_get_contents() ); 745 749 746 750 ob_end_clean(); 751 752 // Clean up! 753 unset( buddypress()->core->email ); 747 754 } 748 755 749 756 return $this; -
src/bp-members/bp-members-functions.php
1079 1079 return false; 1080 1080 } 1081 1081 1082 // Check if account is still pending. 1083 $user = get_user_by( 'ID', $user_id ); 1084 if ( 2 === (int) $user->status ) { 1085 return false; 1086 } 1087 1082 1088 // Assume true if not spam or deleted. 1083 1089 return true; 1084 1090 } -
src/bp-templates/bp-legacy/buddypress/assets/emails/single-bp-email.php
172 172 <tr> 173 173 <td style="padding: 20px; width: 100%; font-size: <?php echo esc_attr( $settings['footer_text_size'] . 'px' ); ?>; font-family: sans-serif; mso-height-rule: exactly; line-height: <?php echo esc_attr( floor( $settings['footer_text_size'] * 1.618 ) . 'px' ) ?>; text-align: left; color: <?php echo esc_attr( $settings['footer_text_color'] ); ?>;" class="footer_text_color footer_text_size"> 174 174 <span class="footer_text"><?php echo nl2br( stripslashes( $settings['footer_text'] ) ); ?></span> 175 <br><br> 176 <a href="{{{unsubscribe}}}" style="text-decoration: underline;"><?php _ex( 'unsubscribe', 'email', 'buddypress' ); ?></a> 175 176 <?php if ( bp_email_is_recipient_to_singular_user() ) : ?> 177 <br><br> 178 <a href="{{{unsubscribe}}}" style="text-decoration: underline;"><?php _ex( 'unsubscribe', 'email', 'buddypress' ); ?></a> 179 <?php endif; ?> 177 180 </td> 178 181 </tr> 179 182 </table>