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 (Moderator: Dave Greenberg) »
  • Question about UpdateMembershipRecord.php
Pages: [1]

Author Topic: Question about UpdateMembershipRecord.php  (Read 1604 times)

klkosi

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 2
  • CiviCRM version: 3.2.2
  • CMS version: Drupal 6.19
Question about UpdateMembershipRecord.php
August 20, 2011, 07:32:51 am
In the CiviCRM guide, these are the instructions for editing and using UpdateMembershipRecord.php:

Quote

Membership Status and Reminder Server Requirement
Keeping Membership Status updated and using the Renewal Reminder Day function requires that on your server you setup a "cron job" to run a script which will update membership statuses and send out reminders.

A command-line php script - bin/UpdateMembershipRecord.php.txt - is provided which updates the status for each membership record based on your configured status rules. This script will also send Renewal Reminder emails to members for Membership Types that are configured to do so:

You will need to edit this file to set the FROM email address at line 197 and save it as UpdateMembershipRecord.php before running it.

Starting with release 1.8 you will need to include the username and password for an authorized Drupal or Joomla user to "authenticate" the script. This must be someone with Edit Contact permissions for contacts.

Starting with versions 2.0.7 and 2.1.2, you will also need to configure a site key to run this script (learn more...).

Then, you will need to setup a "cron job" on your server to execute this script on a daily basis (or periodically based on your organization's requirements).
If you want to script to update Membership Status but do not want to send a reminder email, you can comment out lines approimately 184 through 257 (check your brackets)

Use wget to run the script:
// For Drupal installs - replace <drupal_root> with the base URL of your Drupal site

$ wget 'http://<drupal_root>/sites/all/modules/civicrm/bin/UpdateMembershipRecord.php?
name=<username>&pass=<pw>&key=<sitekey>'

// For Joomla installs - replace <joomla_root> with the base URL of your Joomla! site

$ wget 'http://<joomla_root>/administrator/components/com_civicrm/civicrm/bin/UpdateMembershipRecord.php?
name=<username>&pass=<pw>&key=<sitekey>'
You can also run the script by entering the above URL in your browser location bar. This is a useful trick for debugging any problems you may have running the script.


I've changed the FROM email address as per the instructions and set up the cron job on my server, but I have 2 questions --

My questions are:

1. Where would I put the "site key" information into this file?  I haven't created a site key yet and things are running smoothly for a year.  Do I really need to add that information to this UpdateMembershipRecord.php file and, if so, where and how would I include it in this script?  The "Learn More" link doesn't really explain how to put the site key into the various files it says will need it, just how to create the site key and put it in civicrm.settings.php.

2.  Where and how do I include the user name and password to authenticate this script?  I guess I would use the admin user name and password, but is there a line of script I need to add to this file?

Thank you!!
« Last Edit: August 20, 2011, 07:36:04 am by klkosi »

TheoRichel

  • I post frequently
  • ***
  • Posts: 122
  • Karma: 0
  • CiviCRM version: 4.2.1
  • CMS version: Drupal 6.24
  • MySQL version: 5.9
  • PHP version: 5.3.16
Re: Question about UpdateMembershipRecord.php
August 24, 2012, 10:47:23 am
You use the site key together with your username and passwordd when you either try to run the script through the shell or in the url that you type. I do the latter:
http://www.example.com/sites/all/modules/civicrm/bin/UpdateMembershipRecord.php?namexxxxx&pass=xxxxxx&key=xxxxxxxx

On  the x-s you fill in the username, pw and ultimately the site key

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Question about UpdateMembershipRecord.php

This forum was archived on 2017-11-26.