CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Membership Start and End Dates In Sent Reciepts
Pages: [1]

Author Topic: Membership Start and End Dates In Sent Reciepts  (Read 4537 times)

adizo

  • I post occasionally
  • **
  • Posts: 70
  • Karma: -1
  • It doesn't take time. It takes truth!
  • CiviCRM version: 4
  • CMS version: Joomla
  • MySQL version: 3.6
  • PHP version: php5
Membership Start and End Dates In Sent Reciepts
August 24, 2013, 03:32:33 pm
I noticed that when a membership is renewed, the membership Start and End Date  which the payment covers is not included in the receipt sent to the member who just renewed. How does one include this membership date in the renewal receipt? I  have checked the token but membership start and  end dates are not included in the token list. Any tip will be greatly appreciated.

bighudsonnut

  • I post occasionally
  • **
  • Posts: 84
  • Karma: 2
    • Hudson Essex Terraplane Club site
  • CiviCRM version: 4.6.3
  • CMS version: Joomla 3.4.1
  • MySQL version: 5.5.42
  • PHP version: 5.5.23
Re: Membership Start and End Dates In Sent Reciepts
September 19, 2013, 07:17:46 am
If you go to the scheduled reminders, and pick add a reminder, the tokens for the large text fields do have the membership information to pick as tokens.  You could copy those tokens into your receipt and see if they pull the information in. 

Shai

  • I post frequently
  • ***
  • Posts: 202
  • Karma: 8
    • Content2zero
  • CiviCRM version: 4.3.x, 4.4.x, 4.5.x
  • CMS version: Drupal 7
  • MySQL version: 5.5.x
  • PHP version: 5.3.x, 5.4.x
Re: Membership Start and End Dates In Sent Reciepts
October 19, 2013, 07:43:35 pm
@bighudsonnut,

I tried the approach you suggested using Civi's send email . I pasted the token "{membership.end_date}" in there. But it didn't work.

Anybody know a way of pulling membership tokens into emails?

Thanks.

Shai

Don't miss out! Sign up now for free expert advice on CiviCRM's new StackExchange help site.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Membership Start and End Dates In Sent Reciepts
October 19, 2013, 09:02:35 pm
So, membership related tokens are available from a search where you render the results as memberships. In 4.4 you can send emails or generate pdfs from this same screen. A patch for 4.2 for this is here
https://github.com/CiviCRM42/civicrm42-core/pull/36 (it could go into the next 4.2 release but I don't think anyone is pushing for it to be in 4.2)

we have used this token https://github.com/eileenmcnaughton/tokens/blob/master/latestcurrentmembership.inc to make some membership details available to searches available from the normal contact screens (it looks for the latest expiring current membership). The limitation we hit is where people have 2 memberships expiring on the same day.

We installed civitoken to enable that token (https://github.com/eileenmcnaughton/civitoken) but you could just lift the code & use it as appropriate
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Shai

  • I post frequently
  • ***
  • Posts: 202
  • Karma: 8
    • Content2zero
  • CiviCRM version: 4.3.x, 4.4.x, 4.5.x
  • CMS version: Drupal 7
  • MySQL version: 5.5.x
  • PHP version: 5.3.x, 5.4.x
Re: Membership Start and End Dates In Sent Reciepts
October 20, 2013, 05:11:19 am
Thank you. Awesome!
Don't miss out! Sign up now for free expert advice on CiviCRM's new StackExchange help site.

Shai

  • I post frequently
  • ***
  • Posts: 202
  • Karma: 8
    • Content2zero
  • CiviCRM version: 4.3.x, 4.4.x, 4.5.x
  • CMS version: Drupal 7
  • MySQL version: 5.5.x
  • PHP version: 5.3.x, 5.4.x
Re: Membership Start and End Dates In Sent Reciepts
October 21, 2013, 12:28:05 pm
@Eileen,

Thanks for all the work you've done with tokens for CiviCRM.

So far I haven't been able to get it to work.

Here is what I've done.

1. On my CiviCRM 4.3.7/Drupal 7.23 installation I installed civitoken (which I got from GitHub) to sites/all/modules and turned it on.
2. I created a directory: sites/all/civicrm_custom/custom_templates/tokens
3. I set sites/all/civicrm_custom/custom_templates as the path for custom templates at: civicrm/admin/setting/path?reset=1
4. I put the file latestcurrentmembership.inc (which I got from github) into sites/all/civicrm_custom/custom_templates/tokens
5. I did a contacts search. For the result set I chose "Send Email".
6. I hoped for the membership tokens to show up when I clicked on the tokens icon, but sadly they didn't.
7. I used the token anyway: {latestcurrentmembership.end_date} and sent the email. In the email it just printed the literal and did not replace the token with the dynamic information.

Am I close? Any ideas where I might be going wrong.

Thanks much,

Shai
Don't miss out! Sign up now for free expert advice on CiviCRM's new StackExchange help site.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Membership Start and End Dates In Sent Reciepts
October 21, 2013, 01:10:14 pm
I checked & the readme was wrong

https://github.com/eileenmcnaughton/civitoken/commit/4ec2b6274fcaf533e9f8ddcacf25814256712868

ie. custom php dir not custom templates dir - I increasingly make them one & the same.

If it's working the token will show in that list
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Shai

  • I post frequently
  • ***
  • Posts: 202
  • Karma: 8
    • Content2zero
  • CiviCRM version: 4.3.x, 4.4.x, 4.5.x
  • CMS version: Drupal 7
  • MySQL version: 5.5.x
  • PHP version: 5.3.x, 5.4.x
Re: Membership Start and End Dates In Sent Reciepts
October 21, 2013, 02:13:57 pm
Eileen,

It works!!! Thank you. Thank you.

For others who may come upon this; note that the date output format used by the custom token is hard-coded into latestcurrentmembership.inc; it is not pulled from the settings at civicrm/admin/setting/date?reset=1.

But it is really very easy to customize inside latestcurrentmembership.inc.

Line 28 looks like this:
Code: [Select]
$value['latestcurrentmembership.end_date']= date('m-d-Y', strtotime($membership['membership_end_date']));
which outputs 21-10-2013.

You just need to adjust the arguments of the date function in order to get the output format you want. So for example, I changed it to:

Code: [Select]
$value['latestcurrentmembership.end_date']= date('F j, Y', strtotime($membership['membership_end_date']));
which outputs October 21, 2013.

Here is a handy-dandy reference for PHP's date function: http://php.net/manual/en/function.date.php

Eileen, thanks again for the great work!
Don't miss out! Sign up now for free expert advice on CiviCRM's new StackExchange help site.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Membership Start and End Dates In Sent Reciepts
October 21, 2013, 02:15:21 pm
actually it's also possible to fix the date to pull from settings - I think I have that code somewhere.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Membership Start and End Dates In Sent Reciepts

This forum was archived on 2017-11-26.