0

CiviCRM 4.7.15 for WordPress

Mailings\Message templates\System Message Templates editing an offline Membership template

This template gets emailed whenever selects Edit or Renew under Memberships for a contact. Edit also allows one to override the status to cancelled, expired, on hold, and 5 other states.

HTML section of template

Question 1. Should one be able to click on a token and put it into a template? In my case, it shows </> Tokens.

Question 2. What is the token syntax if you were able to click on one in the token dropdown? I need the address, so I assumed {address.street_name}, but this does not work nor does {$address.street_name}.

Question 3. Why does {$membershipStatus} show the previous status instead of the current one? Is there another token for the current status?

Question 4. {$cancelled} does not follow the Membership status of cancelled. What does it represent?

Question 5. Does anyone else feel that the text-area provided for editing is a little too small? A Message Preview option would be so helpful.

1
  • {debug} gives a nice list, but not of the tokens from the dropdown
    – Codedogs
    Commented Feb 4, 2017 at 0:34

3 Answers 3

1

A.1

  • in my 4.7.x test the dropdown arrow to the right of works to show me the tokens, but does not result in them being inserted. In my 4.6 test this did work (which suggests a JIRA issue might be needed for 4.7 but can't test on dmaster as the drupal permission has not been assigned)

  • in my 4.6.x test the dropdown arrow to the right of works to show me the tokens, and does result in them being inserted.

A.2 address type tokens are {contact.country} and {contact.street_address}

A.3 I don't see any membership based tokens listed. I believe we - Fuzion = did an Extension that can help with this - try this one

A.4 I don't know and am not sure what you are referencing.

A.5 In the 4.6.x it shows as full width and has a handle in bottom-left corner to drag it bigger. In my 4.7.x test it only shows as half-width but still has the handle. Guess if you are missing the handle you may need to check for js errors or something else like a WP theme issue??

Hope that helps you a bit.

5
  • NB my testing was on Drupal but this should all be agnostic
    – petednz - fuzion
    Commented Feb 4, 2017 at 1:17
  • A.4. {$cancelled} appears in the default template. I too would like to know its purpose.
    – Codedogs
    Commented Feb 4, 2017 at 2:06
  • A.5. My version has no such edges. It is as it appears in the picture above. I do remember seeing them in a previous version, though it may have been on a different page.
    – Codedogs
    Commented Feb 4, 2017 at 2:10
  • $cancelled might be to do with the transaction in that case (guessing)
    – petednz - fuzion
    Commented Feb 4, 2017 at 3:04
  • A.5 $cancelled remains false when the status of the membership is cancelled.
    – Codedogs
    Commented Feb 6, 2017 at 14:53
1

Question 1. Should one be able to click on a token and put it into a template? In my case, it shows Tokens.

Answer: Yes. Seems to be disabled in 4.7.15

Question 2. What is the token syntax if you were able to click on one in the token dropdown? I need the address, so I assumed {address.street_name}, but this does not work nor does {$address.street_name}.

Answer:

{capture assign=address_line_2} {contact.supplemental_address_1} {/capture}
{capture assign=address_line_3} {contact.supplemental_address_2} {/capture}
{capture assign=address_suffix} {contact.postal_code_suffix} {/capture}
{capture assign=line_2_size} {$address_line_1|count_characters:false} {/capture}
{capture assign=line_3_size} {$address_line_2|count_characters:false} {/capture}
{capture assign=suffix_size} {$address_suffix|count_characters:false} {/capture}

{capture assign=casem_member_address}
        {contact.street_address}<br/>
    {if $line_2_size GT 0}
        {contact.supplemental_address_1}<br/>
    {/if}
    {if $line_3_size GT 0}
        {contact.supplemental_address_2}<br/>
    {/if}
        {contact.city}, {contact.state_province}<br/>
        {contact.country}<br/>
        {contact.postal_code}
    {if $suffix_size GT 0}
        -{contact.postal_code_suffix}
    {/if}
{/capture}

The supplemental address lines and the postal code suffix are null by default and causes a fatal error in Smarty. (The spinning symbol) However, the above code gets around it.

Question 3. Why does {$membershipStatus} show the previous status instead of the current one? Is there another token for the current status?

Answer: $contribution_status_id does show the correct value for renewals

Question 4. {$cancelled} does not follow the Membership status of cancelled. What does it represent?

civicrm\civicrm\CRM\Member\Form\Membership.php lines 1593 to 1603

$cancelled = TRUE;
if ($membership->end_date) {
  //display end date w/ status message.
  $endDate = $membership->end_date;

  if (!in_array($membership->status_id, array(
    // CRM-15475
    array_search('Cancelled', CRM_Member_PseudoConstant::membershipStatus(NULL, " name = 'Cancelled' ", 'name', FALSE, TRUE)),
    array_search('Expired', CRM_Member_PseudoConstant::membershipStatus()),
  ))
  ) {
    $cancelled = FALSE;
  }
}
// suppress form values in template.
$this->assign('cancelled', $cancelled);

Likely the answer has to do with the fix for CRM-15475.

Question 5. Does anyone else feel that the text-area provided for editing is a little too small? A Message Preview option would be so helpful.

Answer: Alas in the WordPress version, only certain pages are using the chkeditor boxes which can be expanded by the user. I guess they have not propogated these boxes into the Message Edit pages.

1

Q1 was a regression introduced in 4.7. It gets fixed by applying https://github.com/civicrm/civicrm-core/pull/10149 change.

JIRA filed here - https://issues.civicrm.org/jira/browse/CRM-20418

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.