[buddypress-trac] [BuddyPress Trac] #6966: Email Subject special characters display problem with initiator.name token (BuddyPress v2.5.1)

buddypress-trac noreply at wordpress.org
Thu Mar 17 23:19:28 UTC 2016


#6966: Email Subject special characters display problem with initiator.name token
(BuddyPress v2.5.1)
--------------------------+-----------------------------
 Reporter:  richdal       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  API           |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Original post to Support [https://buddypress.org/support/topic/special-
 characters-in-initiator-name-token/]

 Running into a problem with special characters in the initiator.name email
 token. If the name has a special character like an apostrophe (e.g.
 O'Neil) that token displays fine in the email message body. On the
 message's Subject though it appears as...

 {{{
 [RGP] New friendship request from Tom O'Neil
 }}}

 Had a recommendation to try a filter using stripslashes() such as this...


 {{{
 apply_filters( 'bp_email_set_subject', $subject, $this );
 function RGP_email_subject( $subject, $obj ) {
      $subject = stripslashes( $subject );
     return $subject;
 }
 add_filter( 'bp_email_set_subject', 'RGP_email_subject', 15, 2 );
 }}}


 I used that specifically but it did not affect the Subject text.

 I tried a different version of that below. I was able to get the extra
 string of text appended to $subject, but couldn't get either version of
 the str_replace() to change the problem text...


 {{{
 apply_filters( 'bp_email_set_subject', $subject, $this );
 function RGP_email_subject( $subject, $obj ) {
      $subject = stripslashes( $subject );

     //tried this 1st
     //$subject = str_replace( ''', "'", $subject );

     //tried this 2nd
     //$subject = addslashes( str_replace( ''', "'", $subject ) );

     //tried this 3rd
     $subject = str_replace( ''', "TEST", $subject );

     $subject .= " append custom text";
     return $subject;
 }
 add_filter( 'bp_email_set_subject', 'RGP_email_subject', 15, 2 );
 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6966>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list