CiviCRM Community > Developer Discussion

Obtaining Event Summary in EventInfo.php

(1/1)

lchauhan:
Hey Everyone,

Just creating a custom Facebook app for my charity group, but was wondering what is the easiest way to call Event Summary so I can use it for adding a customer Meta tag.

I'm a little confused with API codes Civicrm uses as I work on Wordpress for development mostly and never Drupal!

Cheers,

Lchauhan

Donald Lobo:

Might want to check this patch:

https://github.com/kurund/civicrm-facebook

most likely this will be part of 4.2

The API is the same and its in PHP. So does not matter a lot if u r using WP or Drupal

lobo

lchauhan:
Everything for Facebook is setup just need description. Looking at the code I am assuming I use the following:

--- Code: [nofollow] ---$params = array('id' => $this->_id);
+    $values = array();
+    CRM_Event_BAO_Event::retrieve($params, $values);
+
+    $params = array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event');
+    $location = CRM_Core_BAO_Location::getValues($params, TRUE);
+    $location = $location['address'][1];
+   
+    $stateProvinces = CRM_Core_Pseudoconstant::stateProvince();
+    $country        = CRM_Core_Pseudoconstant::country();
+
+    $venueInfo = array(
+      'street'    => $location['street_address'],
+      'city'      => $location['city'],
+      'state'     => $stateProvinces[$location['state_province_id']] ,
+      'zip'       => $location['postal_code'],
+      'country'   => $country[$location['country_id']],
+      'latitude'  =>  $location['geo_code_1'],
+      'longitude' =>  $location['geo_code_2']
+    );
+   
+    //crm_core_error::debug( $venueInfo );
+    //crm_core_error::debug( $values ); exit;
+    // Create an event
+    $ret_obj = $this->_facebook->api('/me/events', 'POST', array(
+      'name' => $values['title'],
+      'description' => $formValues['summary'],
+      'start_time' => $values['start_date'],
+      'end_time' => $values['end_date'],
+      'privacy_type' => $event_privacy,
+      'venue'        => $venueInfo 
+    ));
--- End code ---

and then use $formValues['summary'] to call the summary?

Navigation

[0] Message Index

Go to full version