Skip to:
Content
Pages
Categories
Search
Top
Bottom

Special characters in initiator.name token


  • richdal
    Participant

    @richdal

    Using WordPress 4.4.2 and BuddyPress 2.5.1

    Wasn’t sure how to fix this. I’m running into a problem with one of the email tokens (initiator.name). If the initiator’s name has a special character like an apostrophe (e.g. O’Neil), the HTML display works fine in the message body but the encoded version of the text is appearing in the subject.

    I took a look at the documentation but wasn’t seeing anything I could change other than using {{token}} or {{{token}}}. Neither versions worked on the subject text.

    [{{{site.name}}}] New friendship request from {{initiator.name}}
    [{{{site.name}}}] New friendship request from {{{initiator.name}}}

    Is there anything I can add to my child theme’s functions.php to correct that? Didn’t know if there was away to create our own token to make an decoded version of that text.

Viewing 3 replies - 1 through 3 (of 3 total)

  • shanebp
    Moderator

    @shanebp

    You might be able to use this filter
    apply_filters( 'bp_email_set_subject', $subject, $this );
    And run stripslashes on the $subject.

    Something like:

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

    But you shouldn’t have to, afaik.
    The issue is probably just due to an over-sight.

    You can open a ticket here, using the same user / pw as this forum.

    Include a link to this topic.
    And if you try the filter above, the results of that test.


    richdal
    Participant

    @richdal

    Thanks for the recommendation. I tried adding that to the child-theme’s functions.php file but didn’t have an affect. I experimented a little by trying to append text and replace the problem text, but could only get the append to work. I opened a ticket.

    Thanks for creating the ticket. I vaguely recall handling a similar issue, but I think that was with the “From Name”, so we should be able to fix this up.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar