31 October, 2011
By jamie
Filed under API

As of the Bourne, UK sprints last August, bin/cli.php has been completely re-written for 4.1.

If you are an integrator or user, you might not have noticed this file. It used to be a PHP class that was used by many of the individual scripts in the bin directory.

Now, it's a command line program designed to be run directly.

With cli.php you can run any function defined in the API version 3.

If you run the script without any arguments, you'll get a usage statement explaining how it works:

0 jamie@chicken:bin$ php cli.php 
The --action argument is required
Usage: cli.php -e entity -a action [-u user] [-s site] [--output] [PARAMS]
 entity is the name of the entity, e.g. Contact, Event, etc.
 action is the name of the action e.g. Get, Create, etc.
 user is an optional username to run the...
Read more
15 October, 2011

As most non-profits know, driving revenue exclusively off of events can be a hit or miss adventure.  Revenues YOY are not consistent, and its difficult to find those supporters who will organize and host fundraising events to support your cause.  Many are intimidated by hosting large fundraisers or simply don't have the time or resources to pull it off.  So to sum up our problem: we needed a broader more consistent source of revenue to fund our programs.     To expand our source of revenue, we looked to our community of donors, families, and fundraisers to raise money on our behalf through their own social networks.  The average user on facebook has 30 friends [http://www.facebook.com/press/info.php?statistics] which means that we could exponentially increase our reach through online social networking...

Read more
28 September, 2011
By totten

CiviCRM 3.4.x and 4.0.x introduced API v3, a more consistent set of interfaces for integrating with CiviCRM using PHP, Smarty, Javascript, and REST. Building on this consistent core API, recent CiviCRM updates have introduced even more ways to manipulate your data -- such as chaining and CSV batch importing.

Thus, functions implemented according to the API v3 conventions can be invoked several different ways. If you would like to leverage this infrastructure for use with a new or customized API call, then download the latest release. With 3.4.6/4.0.6, external developers can expose API functions for new entities, new actions, and even generic actions.

This would, for instance, allow you to create an API that returns the top donations of a person, grouped by contribution...

Read more
28 September, 2011
By cpc

As a freelancer, here are a few notes and an overview on how I solved a client's contacts consolidation when the data came from external sources:

My Use Case
- Client had ongoing events and conferences over several years which meant there were databases and mailing lists all over the place (many of which had crossover).
- I set up ongoing JSON exports of the contact data from the external sites, which could be queried by date range to get the latest changes.
- I had a contact consolidation script on the CiviCRM end, that took these JSON exports, and loaded them into Civ via the API.
- About 5 different source sites created about 1200 contacts

A Few Challenges
- The documentation can be quite scattered and it was difficult sometimes to find the right versions. I really pity whoever has to deal with this challenge though!
- It took me much longer than it should have to learn how to activate the API...

Read more
06 September, 2011
By xavier

Hi,

Two weeks already since civicon, the dust has settled and Amy Dobbs and the team at skillmatters have filmed and uploaded the sessions.

  • For those that have attended CiviCon london and ended up the day desperate about all the nice sessions they missed, you'll be pleased to know that you can see them online.
  • For those that missed CiviCon london, well, really, you should have been there, we missed you and we hope you'll be able to attend the next one.
  • For the speakers, could you post a comment with a link to your slides? I'll update this article.

Anyway, the videos are online too, a couple needs some setting changes to be viewed, stay tuned and come back soon.

 

welcome to civicon state of the project & keynote

By Kurund Jalmi,...

Read more
31 August, 2011
By jamie
Filed under API, Drupal
I hope Michal will forgive me for typing during his Developer training presentation on tests. Since I heard the presentation at CiviCon, I instead tried, as an exercise based on what we learned this morning, to create a custom group and custom field via the install hook in a Drupal module. Here are the results...
 

function civicrmtest_install() {
  civicrm_initialize();
  require_once 'api/api.php';
  $params = array(
    'version' => 3,
    'extends' => array('Individual'),
    'title' => 'JamieGroup',
    'is_active' => 1,
  );
  $result = civicrm_api('CustomGroup','Create',$params);
  if($result['is_error'] == 1) {
    drupal_set_message('Error creating Custom Group');
    drupal_set_message($result['error_message']);
  } else {
    $value = array_pop($result['values']);
    $custom_group_id = $value['id'];
    variable_set('civicrmtest_custom_group_id',$custom_group_id);
    $params = array(
      'version' => 3,
      'label' => 'JamieField',
      '...
Read more
29 August, 2011
By jamie
Filed under API, Sprints

If you've ever configured a schedule task (aka cron job) for CiviCRM, you know the routine. You have to look up the username and password for a user in your database that has database permissions, you have to find a really long mess of characters known as your site key, you have to find the proper name of the job you want (like UpdateAddress.php or civimail.cronjob.php) and then you must string them all together in precisely the right way to make the cron job.

What a tedious drag.

To lay the ground work for the Consolidated Cron Make it Happen, which will make all this much easier to setup, we're first doing some major re-organizing of the underlying code.

Currently, all of the code for running these tasks are independently stored in one-off scripts in the bin directory. This organization makes it very difficult to run the code in different contexts. For example, if you are using drush, it would be convenient to be...

Read more
06 June, 2011
Filed under API, Drupal, Extensions

Fans of Webform CiviCRM Integration will be happy to hear that version 2 is now available for testing. And if you're not already a fan of that module, this might put you over the edge.

With version 1, you were able to:

  • Create/update a single Individual via webform
  • Log a simple activity for that contact when the form was submitted
  • Allow the user to opt-in to groups
  • Tag contacts

Version 2 take that to a whole new level, giving you the ability to:

  • Expose a virtually unlimited number of contacts per webform (so your users can enter their entire family, team, etc. on a single form).
  • It handles any type of contact, and supports multiple addresses, emails, phones, websites, and custom fieldgroups per contact.
  • Create Relationships between the multiple contacts on the form!
  • It also exposes activity fields...
Read more
05 June, 2011
Filed under v3.4 and v4.0, API, Joomla

A great thing in CiviCRM v3.4 and v4.0 is that for Joomla! users there is a new helper file that makes it very easy to access the CiviCRM API. That combined with version 3 of the API makes it easier than ever to put CiviCRM data anywhere in your site. I'm going to show you how I made a module that shows the groups a logged in user is a member of. Because it uses the API this can display on any page whether or not it is a CiviCRM page.

A few notes before I start. This is going to be a Joomla! 1.6 module. Also, I did have to make a slight change to administrator/components/com_civicrm/helpers/api.php, changing 
$this->civiInit( );
to
self::civiInit( );
at line 31. Also I'm going to make this module Joomla! style, which means that it can have a layout override or alternative layout.

... Read more
13 May, 2011
By xavier
Filed under API, Architecture

Hi,

Some improvements on permissions and the API are landing on 3.4.2 and 4.0.2.

On the previous versions, the permissions where not enforced (on php and smarty) and checked on the same permission "access civicrm" for the rest and ajax no matter the operation and entity.

 

As API v3 is exposing more and more entities, it became necessary to control better what could be accessed. We re-used the permissions has defined on drupal for the menues, but instead of applying them to a path (in order to access civicrm/admin/event  the user need the priviledge "access CiviEvent"), we applied them to the entities and action (in order to create an event using the api, the user need the priviledge "access CiviEvent").

 

We realised there isn't a perfect match between these two logics "protect what pages and form you can access" vs. "protect what type of content and action...

Read more