[buddypress-trac] [BuddyPress Trac] #6915: BP Email template: the unsubscribe link & the account activation email

buddypress-trac noreply at wordpress.org
Wed Feb 17 19:13:25 UTC 2016


#6915: BP Email template: the unsubscribe link & the account activation email
------------------------------------+------------------
 Reporter:  imath                   |       Owner:
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  2.5
Component:  API                     |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |
------------------------------------+------------------
Changes (by r-a-y):

 * keywords:  dev-feedback => dev-feedback has-patch


Comment:

 > I'd rather take the time to consider replacing the basic/simple token
 parsing logic with a real Mustache template parser.

 I think this would be very cool and quite easy to integrate.

 Only question is what Mustache parser we would want to use.

 * [https://github.com/bobthecow/mustache.php mustache.php] is linked from
 the official mustache Github page.  Could use Composer for this, but
 library is 176kb.
 * [https://github.com/zordius/lightncandy LightnCandy] claims to be 2-7
 times faster than mustache.php, but requires PHP 5.3 due to namespaces.
 Library is also 196kb.

 For `6915.mustache.patch`, I decided to pick a lesser-known library,
 [https://github.com/KiNgMaR/php-mustache php-mustache], that is only 40kb
 and licensed under the BSD.  We can pick and choose any library, I just
 chose one that was relatively small.

 To address the issue in this ticket, I've included some unit tests for
 `bp_core_replace_tokens_in_text()` and have changed the email template to
 use a mustache section for the unsubscribe block -- `{{#unsubscribe}}`.
 The `'unsubscribe'` token is only added if the user is active.  See the
 changes made to `bp_email_set_default_tokens()` and `bp_is_user_active()`.

 Now, the unsubscribe link will not show up in registration and activation
 emails.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6915#comment:5>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list