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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Event Search Stopped working on upgrade from 3.1.2 to 3.1.4, what API changed?
Pages: [1]

Author Topic: Event Search Stopped working on upgrade from 3.1.2 to 3.1.4, what API changed?  (Read 789 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Event Search Stopped working on upgrade from 3.1.2 to 3.1.4, what API changed?
April 19, 2010, 05:01:58 pm
I figured this out, solution below, wiki updated.... Been using this verbatim and successfully for over a year in a Drupal block on my site:
http://wiki.civicrm.org/confluence/display/CRMDOC/List+of+Upcoming+CiviEvents+or+Feed+of+Events

Upon upgrade from 3.1.2 to 3.1.4 it stopped working and now returns "No events found."  From my debugging it looks like it's not finding the CiviCRM API function at all, as we have many events in our system, and it was working before the upgrade, or at least I remember it was, and the client would have been screaming if it wasn't working... :)  Why did this issue suddenly popup in 3.1.4?

 print_r($myEvents) prints only the $params, nothing else.  So my guess was that's the variable wasn't even getting set.    But after reading this page, I got no insight into what it might be, except a search example that was much different than the cookbook in the wiki.
http://wiki.civicrm.org/confluence/display/CRMDOC/Event+APIs

UPDATED This was the old code....

Code: [Select]
if (module_exists('civicrm')) {
  civicrm_initialize(TRUE);
  require_once 'api/v2/Event.php';
  // This example limits listing to public and active events
  $params = array ('is_public'     => 1, 'is_active'     => 1);
  $myEvents = civicrm_event_search( $params );

this is the new, edited based on the new example that I found and adapted to suit Kurund's code
Code: [Select]
 $params = array (
   'return.id' => 1,
     'return.title' => 1,
   'return.end_date' => 1,
   'return.start_date' => 1,
   'is_public' => 1,
   'is_active' => 1,
   'return.max_results' => 9999
   );
  $myEvents = civicrm_event_search( &$params );

Note that the API for civicrm_event search has changed rather dramatically, not sure why, but I have updated the wiki with this info.

« Last Edit: April 19, 2010, 10:44:31 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Event Search Stopped working on upgrade from 3.1.2 to 3.1.4, what API changed?
April 20, 2010, 12:18:58 am
Basically It is bug introduced in CiviCRM v3.1.4

When there are no return properties pass in params we should fetch events w/ default properties.

So old code is also right to fetch events w/ default set of fields,
and your code is also right to fetch events w/ some specific properties.

Filed issue is here : http://issues.civicrm.org/jira/browse/CRM-6120

Would be great if you update wiki doc accordingly.

thanks

kiran
You Are Designed To Choose... Defined By Choice.

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Event Search Stopped working on upgrade from 3.1.2 to 3.1.4, what API changed?
April 20, 2010, 09:38:25 am
Thank you for an explanation, I have made a note of it and updated the wiki
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Event Search Stopped working on upgrade from 3.1.2 to 3.1.4, what API changed?

This forum was archived on 2017-11-26.