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 CiviEvent (Moderator: Yashodha Chaku) »
  • Pulling manual Block of Events
Pages: [1]

Author Topic: Pulling manual Block of Events  (Read 955 times)

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Pulling manual Block of Events
December 01, 2009, 06:40:43 pm
I've always had a custom coded block on my Drupal site displaying upcoming events (and somewhat tailored beyond the one built into Civi).

I just upgraded to 3.0 and my events disappeared. I've tracked it down to a small code snippet which I've noticed will only return the first 25 results (which are all past events, and thus nothing is showing up). Should I be passing some other param to civicrm_event_search? I checked civicrm/api/v2/Event.php and don't see the magic number '25' anywhere...I see a limit of 1000 and an option for an offset, but manually changing either of these doesn't change my results. What do I have to do?

Code: [Select]

<?php 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 );
  
  if (
$myEvents) {
    
    
// Call the sorting function
    
foreach ($myEvents as $event) {

     
// HERE'S WHERE ONLY 25 GET PRINTED EVEN THOUGH THERE ARE HUNDREDS IN THE DB!
      
print $event['start_date'];
    } 
// End foreach
  
}  
} 
// End if CiviCRM exists

?>

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Pulling manual Block of Events
December 01, 2009, 07:05:04 pm

check and apply the patch from here:

http://issues.civicrm.org/jira/browse/CRM-5266

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Pulling manual Block of Events
December 02, 2009, 05:49:24 am
that does the trick, thanks.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Pulling manual Block of Events

This forum was archived on 2017-11-26.