Book Image

CiviCRM Cookbook

Book Image

CiviCRM Cookbook

Overview of this book

CiviCRM is a web-based, open source, Constituent Relationship Management (CRM) software geared toward meeting the needs of non-profit and other civic-sector organizations.Organizations realize their mission via CiviCRM through contact management, fundraising, event management, member management, mass e-mail marketing, peer-to-peer campaigns, case management, and much more.CiviCRM is localized in over 20 languages including: Chinese (Taiwan, China), Dutch, English (Australia, Canada, U.S., UK), French (France, Canada), German, Italian, Japanese, Russian, and Swedish.CiviCRM Cookbook will enhance your CiviCRM skills. It has recipes to help you use CiviCRM more efficiently, integrate it with CMSs, and also develop CiviCRM.This book begins with recipes that help save time and effort with CiviCRM. This is followed by recipes for organizing data more efficiently and managing profiles.Then you will learn authentication and authorization and managing communication with contacts.Then you will be guided on using the searching feature and preparing reports. We will then talk about integrating Drupal and CiviCRM. You will also be taught to manage events effectively. Finally, learn about CiviCampaign, Civimember, and developing CiviCRM.
Table of Contents (19 chapters)
CiviCRM Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating custom date tokens


Sometimes there is a token that is not available to you, so you will have to create it programmatically. This recipe shows a very simple example of adding a date token for the current date. It uses plugin code , which means you can substitute different token values.

Getting ready…

You don't really need to know much PHP but it helps if you know the basics of how to set up a basic Drupal module.

How to do it…

In this recipe we will create our own Drupal module to do the work. This is not too intimidating, particularly as our code is readily available online.

  1. Create a folder in /sites/all/modules and give it a suitable name. Let's call this one Cookbook.

  2. Inside this folder create a file called cookbook.info.

  3. Open cookbook.info and add in the basic code that Drupal needs to identify the module:

    name = Cookbook
    description = Custom CiviCRM functions
    core = 7.x
    files[] = cookbook.module

    Easy!

  4. Create a file called cookbook.module and add in this code:

    <?php
    function cookbook_civicrm_tokens...