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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Event API - Not Working. Feedback would be appreciated.
Pages: [1]

Author Topic: Event API - Not Working. Feedback would be appreciated.  (Read 1529 times)

jeremymcminn

  • Guest
Event API - Not Working. Feedback would be appreciated.
November 02, 2010, 07:56:17 am
Hi Guys

I am trying to get the API snippet
Quote
http://wiki.civicrm.org/confluence/display/CRMDOC32/Using+CiviCRM+APIs+-+Code+Snippets#UsingCiviCRMAPIs-CodeSnippets-ListPublicEventsbyEventTypeinaBlock
to work on my website but no joy.

What happens is that I put the PHP code into a Drupal block or page, set the input format to PHP and what comes up is "No event found".  I have set the id of the event type to the id of all my events that are public and active and still no event are being found.  Any ideas?  Slightly frustrating.

Any help would be appreciated immensely.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Event API - Not Working. Feedback would be appreciated.
November 02, 2010, 10:12:55 am
Hi Jeremy,
are you familiar with PHP and do you understand what is in the code snippet? Just to make sure I help you at the right level  ;D
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Event API - Not Working. Feedback would be appreciated.
November 02, 2010, 11:33:05 pm
Hi,

Have you changed the event type id in the code, and are you sure that you have events of that type that are public ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

jeremymcminn

  • Guest
Re: Event API - Not Working. Feedback would be appreciated.
November 05, 2010, 07:09:10 am
Hi guys thanks for the replies!

@Erik - Yes I am familiar with PHP and understand whats in the code snippet, I am not an uber pro with it all though, but the code seems pretty self explanatory to me - which is why I am confused because it is such a basic piece of code. 

@Xavier - Yes I changed the event type ID to 81 which is id for that particular event type in CiviCRM.  I also made sure all events were public and active.  I tried a similar code snippet showing all upcoming courses and it had the same problem.

Thoughts?  Much appreciated guys.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Event API - Not Working. Feedback would be appreciated.
November 05, 2010, 07:16:19 pm
Hi,

If you are just after an events block then unless it won't meet your needs for some reason I would suggest you use Views to create the block rather than write it in PHP.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

jeremymcminn

  • Guest
Re: Event API - Not Working. Feedback would be appreciated.
November 08, 2010, 06:03:28 am
Thanks Eileen, not after the block - but want to be able to list upcoming events restricted by type in a node.  I am having a bit of a struggle since the code snippet is not working and I have no clue where to go from here to find a solution.....

Has anybody else had these problems?

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Event API - Not Working. Feedback would be appreciated.
November 08, 2010, 06:21:48 am
Experienced no problems ... but never used the snippet! My guess would be that the output from the search is different, did you check what the actual output from the civicrm_event_search is? Perhaps you can test this with the API? Are you familiar with that? In any case, that is what I would do first :-)
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

jeremymcminn

  • Guest
Re: Event API - Not Working. Feedback would be appreciated.
November 08, 2010, 06:59:24 am
Cheers Erik - do you have basic instructions on how I test the output?

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Event API - Not Working. Feedback would be appreciated.
November 08, 2010, 07:40:23 am
Check this link:
http://en.flossmanuals.net/CiviCRM/DevelopAPI
If that leaves you still confused let me know :-)
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Event API - Not Working. Feedback would be appreciated.
November 08, 2010, 10:42:24 am
not clear to me what it is about a Views solution that fails your use case
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

malks

  • I post occasionally
  • **
  • Posts: 81
  • Karma: 7
  • CiviCRM version: 3.4.x 4.x
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Event API - Not Working. Feedback would be appreciated.
November 09, 2010, 05:01:05 am
Hi,

The snippet as is worked for me.  Maybe try passing in an empty $param array so you get all your events.  This is a reason I hate PHP eval'd like this, makes it hard to debug.  I'm not sure what is meant by testing with the API either... isn't the snippet using the API?  Or do you mean putting it into a module?

Anthony.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Event API - Not Working. Feedback would be appreciated.
November 09, 2010, 11:27:01 am
I usually test things with REST
e.g

http://eg.org/civicrm/ajax/rest?fnName=civicrm/event/get

(Note this incorrectly returns "1 25 events matching input params " because the API has not been brought into line with standards and this works

http://eg.org/civicrm/ajax/rest?fnName=civicrm/event/search
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Event API - Not Working. Feedback would be appreciated.

This forum was archived on 2017-11-26.