Integrating with Facebook Events

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by amir simantov on October 4, 2009 at 10:37am

Is there any way to get events of facebook users/fanpages/groups into drupal?

Thanks

Comments

This would be the most killer

Posted by pribeh on October 7, 2009 at 11:16pm

This would be the most killer integration with Facebook ever. But no I don't think there currently is. Not Gigya, nor FBConnect or Drupal for Facebook have such an integration.

Wallflux events

Posted by eiland on August 29, 2012 at 7:29am

If you want to sync the Facebook events from a Facebook group or page through an ical connection, you should use Wallflux Events.

Giving it another thought...

Posted by amir simantov on October 8, 2009 at 2:10am

I am not sure that fb gives such an api - it will allow people not to use its interface and they will use commercials. Alternatively, they might put ads inside the data provided (which can be filtered by reading code, so will - again - not be good for fb).

So?...

setup a facebook user

Posted by mxmilkiib on October 19, 2009 at 3:27am

setup a facebook user account, subscribe it to the group/whatever. use fbcal.com to generate an ical from the events it is invited to. use the date/Calendar ical import into Drupal.

MilkMiruku

This sounds very promising,

Posted by amir simantov on October 19, 2009 at 12:32pm

This sounds very promising, thanks! I will give it a try and post an update here.

Facebook API - Events.create

Posted by Mark_Watson27 on November 9, 2009 at 5:23pm

http://wiki.developers.facebook.com/index.php/Events.create

Description
Creates an event on behalf of the user if the application has an active session key for that user; otherwise it creates an event on behalf of the application. Applications can create events for a user if the user grants the application the create_event extended permission.

If you are creating an event on behalf of a user, then your application is an admin for the event, while the user is the creator.

You can upload an image and associate it with the event by forming the request as a MIME multi-part message. See photos.upload for details on the message format to use and the supported image types. You can replace or delete images in an event using events.edit.

This method does not require a session key. However if you call this method without an active user session, then your application is both the creator and admin for the event.

fbcal does not seem to work

Posted by amir simantov on December 1, 2009 at 3:50pm

@MilkMiruku:

After several tries, I did not succeed in making it work.

I want it to make a feed, somehow, from iCal, and make nodes out of it, mapping the date to the date CCK field.

Also, I have tried through Google calendar and didn't work (empty calendar).

Amir

OK fbcal works for getting events of users!

Posted by amir simantov on December 20, 2009 at 8:01am

It does need some tries and errors. I could not, however, get events of groups (don't know yet about FanPage's events).

fbcal seem to stopped working!

Posted by amir simantov on December 25, 2009 at 1:29pm

Hi,

I was using this tool for some weeks very successfully. However, it seems that it is not working anymore - it is like that for a couple of days now.

If i click on "Get your calendar now" button (target url is create.php) it takes me to a blank page addressed as http://www.fbcal.com/create.php?auth_token=[MY_KEY_HERE].

This makes feedapi stop creating new items. If you try to refresh the feed manually you get a "Could not refresh feed" error.

Thanks,
Amir

Use FQL

Posted by MikeBC on January 6, 2010 at 10:53pm

with the FB php client library and fbconnect drupal module, you can send a FQL query to FB to pull all of the events related to a user or group (haven't tried with fan pages yet). Unfortunately, you need to make your FQL queries "indexable" (whatever that means) which means in practice that to pull events related to a group you also need the uids of all users authorized to create events for that group as well as the gid for the group. I have a model query and some raw php code i will post here tonight (after I'm done upgrading my drupal install) for y'all to look at.

fbcal returned to work...

Posted by amir simantov on January 6, 2010 at 11:45pm

event retrieval code

Posted by MikeBC on January 7, 2010 at 6:52pm
<?php
$query
= 'SELECT start_time, host, location, eid, name, tagline, creator

FROM event

WHERE creator = [group-id]

AND eid IN (
SELECT eid FROM event_member
WHERE (
(uid = [uid1])
OR (uid = [uid2])
OR (uid = [uid3])
OR (uid = [uid4])
)
)'
;
try {
$rows = facebook_client()->api_client->fql_query($query);
}
catch (
Exception $e) {
$msg = 'Exception thrown while using fbconnect_get_connected_friends: @code';
$args = array('@code' => $e->getMessage());
watchdog('fbconnect', $msg, $args, WATCHDOG_WARNING);

}
asort($rows);
echo
"<br>Count = ". count($rows) . "<br>";
foreach (
$rows as $key=>$row) {
$rows[$key]['start_time_x'] = date("M d, Y - h:ma", $row['start_time']);
}

echo
"<pre>";
print_r($rows);
echo
"</pre>";
?>

bracketed items should be replaced with the FB group ID # and uids 1-4 (or however many you need or want) are necessary to make the FQL query indexable -- those uids should be a set of people who are group members and who, among them, were invited to all of the events in question.
For some reason I am getting weird results in the 'start_time_x' field with regards to resolving the start times in human-readable form but I am working on that.

/edit: this won't pick up events associated with the group if the invite list is private

you can use the events api from facebook

Posted by dishui on February 28, 2010 at 9:08pm

Here is the link to an tutorial on how to use the facebook event api: http://www.phpeveryday.com/articles/Facebook-Programming-API-Events-P852...

This is great dishui

Posted by amir simantov on March 1, 2010 at 7:19am

I would like to pay for a drupal programmer to make a module out of it - if there is one interested - please contact me.

..and i`m ready to pay you

Posted by pyro on March 2, 2010 at 10:06am

..and i`m ready to pay you Amir for this module :)

Bump. Amir, please contact me

Posted by pribeh on March 9, 2010 at 6:12pm

Bump. Amir, please contact me if you ever get this made.

FBConnect Events module

Posted by katbailey on April 10, 2010 at 12:42am

Hey all,
I've written a module for use on lilithfair.com. You can see it in action here: http://lilithfair.com/events/SeattleGeorge-WA/187/lineup
I'm not sure if I'll actually be releasing it as a contrib module but for the time being you can access the code here:
git://github.com/katbailey/fbconnect_events.git

Hope you find it useful!

Katherine

Hai katbailey, What is

Posted by pyro on April 20, 2010 at 7:08pm

Hai katbailey,

What is purpose of this module? I cant get it to work...

Hi katbailey, I could access

Posted by pribeh on April 10, 2010 at 12:58am

Hi katbailey,

I couldn't [edit] access that git url. Also, I can't seem to access lilithfair.com. Is there a chance you could check it? I'm very interested in trying your module out.

Thanks!

Hi pribeh, can you access

Posted by katbailey on April 10, 2010 at 1:01am

Hi pribeh,
can you access http://github.com/katbailey/fbconnect_events ?
As for lilithfair.com, it's definitely up and running so I don't know why you can't access it... :-/

Katherine

Great, I can access both now.

Posted by pribeh on April 10, 2010 at 1:22am

Great, I can access both now. Thanks. I'll give it a shot!

Cool website by the way.

Sorry - I've been meaning to

Posted by katbailey on April 20, 2010 at 8:34pm

Sorry - I've been meaning to post some more info on this. The most important thing to note is that there were bugs in the code when I first committed it and posted about it here - so you'll need to get a fresh checkout of it if you were working with the original code I put up.
Now, the way it works - and bear in mind this was built custom for a client and then I genericised it afterwards so it may not be what you're looking for - basically, if you have a node type that has a field called fbeid (field_fbeid), then when you display a node of this type and its fbeid is a valid facebook event id, this module will add event information from fb to your node. It will display thumbnails of attendees (by default it shows 10 but this is a configurable setting), the event title, and, if you are connected via fbconnect and have authorised the app to rsvp to events on your behalf, a sign-up form.
Let me know if you have any more trouble getting this working.

Manual or Automatic?

Posted by amir simantov on April 21, 2010 at 6:31am

Hi Katherine,

You said: "...when you display a node of this type and its fbeid is a valid facebook event id..."

How do you populate a node with value of the proper fbeid? Manually? Or do you use any feed?

Thanks.

Hi Amir, this module is only

Posted by katbailey on April 23, 2010 at 6:50pm

Hi Amir,
this module is only concerned with displaying existing events - it does not do creation of events. So if you want to test it, create a content type called e.g. event, with a field_fbeid cck text field. Create a node of this type and put in a valid fbeid in this field. When you view the the node you should see the event information.

Katherine

Fatal error

Posted by vhwouter on November 6, 2010 at 11:36am

Hi Katherine,

Any idea why I get this error?

Fatal error: Call to a member function users_isAppUser() on a non-object in \sites\all\modules\fbconnect_events\fbconnect_events.module on line 79

=> line 79: $is_app_user = $fb->api_client->users_isAppUser($fbuid);

I use FBconnect v2.

Grtz

what's the return value of facebook_client() ?

Posted by xurizaemon on November 7, 2010 at 5:21am

(from https://github.com/katbailey/fbconnect_events/blob/master/fbconnect_even...)

<?php
if (isset($node->field_fbeid) && $fb = facebook_client()) {
$fbuid = fbconnect_get_fbuid();
$eid = $node->field_fbeid[0]['value'];
try {
// has this user authorised this app before?
$is_app_user = $fb->api_client->users_isAppUser($fbuid);
}
?>

Try adding dpm($fb); before line 79 (which is $is_app_user ...). Let us know what value you see for $fb at this point.

It looks like facebook_client() has returned some value which evaluates to TRUE, but is not actually a facebook client object (possibly the returned value is intended to convey an error, and the test above doesn't interpret it as such).

(削除) At a guess, I'd say your Facebook client may be incorrectly configured, but that's a guess (might be able to help more if you can provide more info). (削除ここまで) EDIT: I apologise, I'd misread the error. It appears that the $fb object has changed its structure (or perhaps is misconfigured) - you're getting a (possibly) valid $fb back as a client, but this one doesn't have the object $fb->api_client attached. Need more info to debug. (Prob best done in an issue on the module, rather than here on g.d.o.)

Good luck!

If my comments have helped you, please pay it forward!
Use issue queues to discuss module issues - this will help your questions assist others (including yourself!) in future.

Thank you for you quick

Posted by vhwouter on November 7, 2010 at 3:40pm

Thank you for you quick reply.

I've managed to get the module fully working. This module depends on the FBCONNECT version 1 module, which has an api_client defined.

vhwouter, I know this is an

Posted by Junaos on December 9, 2010 at 6:11pm

vhwouter, I know this is an old comment, but were you ever able to get this working with v2? If not, were you able to stack v1 and v2?

+

Posted by vhwouter on December 10, 2010 at 12:39pm

Hi Junaos,

I didn't port it to FBconnect V2. So the downside is that you can't use any fb-module with it that uses the new sdk php librarie.
I'm fairly new to developing modules in drupal. But when I have the time..I'm gonna study it and try to port it to the new version.

Hi Katherine, Is your module

Posted by pribeh on September 21, 2010 at 2:38pm

Hi Katherine,

Is your module still working now with all the API changes Facebook has made over the last few months.

Thanks,

Thomas

No, this module does not work

Posted by handsofaten on December 29, 2010 at 2:23am

No, this module does not work with the newer Graph API. For one thing, anything that looks like this (see line 195):

<?php
$members
= $fb->api_client->events_getMembers($eid);
?>

Would need to be updated to the new API format (in this case):

<?php
$members
= $fb->api('/'.$eid.'/invited');
?>

I'm working on an implementation of it with the new API, but I'm not sure I'll be doing everything the original module did, or in the same ways. In any case, I'll try to post some tips on updating it as I figure things out (I've never actually used Facebook's API before, so I'm learning as I go).

I have this working with

Posted by handsofaten on December 30, 2010 at 10:53pm

I have this working with Graph API, and the Drupal for Facebook module (as opposed to the Facebook Connect module). The reason for the change of dependencies is that the Facebook Connect module doesn't allow you to customize extended permissions requests from the admin settings, which I wanted to be able to do. If anyone wants me to post my code, I could fork Katherine's module on git and post my changes, which aren't drastic.

havent worked with the Drupal

Posted by vhwouter on December 30, 2010 at 11:45pm

havent worked with the Drupal for facebook module.. but I'm definitely interested!
nice job!

Definitely interested

Posted by dipen chaudhary on December 31, 2010 at 1:52am

Hey,

I will soon be starting a project to integrate fb events with DFF and your code will definitely be a good start, I was planning to work it out as sub module of DFF but if you have got it already then I can work to improve it as my scope kind of requires 360 degree treatment. Where do you plan to put up the code, you could either put it on github or roll out a project on drupal.org.

Cheers


Dipen Chaudhary
Founder, QED42 http://www.qed42.com Drupal development

Bump for posting it to

Posted by pribeh on December 31, 2010 at 2:27am

Bump for posting it to Drupal.org.

Ok, I have posted my code on

Posted by handsofaten on December 31, 2010 at 7:46pm

Ok, I have posted my code on github. I was having trouble forking the original, so this is just its own project. It's just as well, since katbailey's version wasn't exactly an active project (but it provided a great starting place for me, as I hope this does for someone else). Check the readme for more info. In my testing it works well with Drupal for Facebook and FB's new API. If someone wants to put this on Drupal.org and think through how it should be designed to be a really useful module, I'd be happy to help out. But for now it just serves my purposes and doesn't allow for much customization without actually changing the code.

https://github.com/handsofaten/fb-events

Thanks Katherine, and good luck everyone!

PS. This is what it looks like on the site I'm developing. You'll have to add some CSS on your own to make it format like this, though.

Logged out view:

Only local images are allowed.

Logged in view:

Only local images are allowed.

Thanks so much for sharing

Posted by pribeh on December 31, 2010 at 9:34pm

Thanks so much for sharing your work on this handsofaten. And thanks again to Katherine for her original work. I still think this would be great to expand upon a little and putting it up on Drupal.org would be the way to go in that regard. dipen chaudhary, do you have a CVS account and are you looking to possibly become the maintainer of this project if so?

This is great! Yes, I pretty

Posted by katbailey on December 31, 2010 at 9:36pm

This is great! Yes, I pretty much abandoned that code after putting it up on Github so I'm very happy to see that someone else has picked it up and moved it along. Nice work handsofaten! :-)

Hi handsofaten, it mentions

Posted by pribeh on January 15, 2011 at 4:32pm

Hi handsofaten, it mentions in the readme for fb_events that any CCK field labeled "field_fbeid" will pick up the event info from Facebook. What kind of CCK field should we be using though? A text field or? Thanks for your help.

Yes, a text field. CCK number

Posted by handsofaten on January 15, 2011 at 4:53pm

Yes, a text field. CCK number field does not allow enough digits. I believe it needs to allow for 12 chars.

Thanks for responding

Posted by pribeh on January 16, 2011 at 12:00am

Thanks for responding handsofaten. I guess I still am a little unsure as to how this works. Am I to input the url of the Facebook created event in the suggested field? Just how am I supposed to link the event from Facebook with the event populated on my site?

Re @ Pribeh

Posted by vhwouter on January 16, 2011 at 1:11am

I havent test this version yet..but since it is a port and the variable of the text field is still the same.. this should work:

In the textfield assigned to field_fbeid you put the ID of the event. This ID can be found in the url of the even-facebookpage.

example: http://www.facebook.com/event.php?eid=0000000000&index=1

ID=0000000000

Have Fun and thanks for the port Handsofaten.

Yes, this is correct. Would

Posted by handsofaten on January 16, 2011 at 5:44am

Yes, this is correct. Would not be terribly hard to make this more intuitive, but as it stands you just find the eid and enter that number.

Does not render...

Posted by starsinmypockets on January 21, 2011 at 11:32pm

Hmm..
dpm($members); at the end of hook_nodeapi() returns the list of attendees.. so, the connection with fb is live, however, drupal is not rendering anything... Any thoughts?

Have you checked the tpl

Posted by handsofaten on January 22, 2011 at 12:18am

Have you checked the tpl file? My guess is that either the tpl file is not being rendered for some reason, or it's not being appended to $node->content (look at lines 154 - 161 in the module file). Let us know if you find the problem.

Edit: specifically, you could try printing $output and/or $node->content['fb_event'] at the end of the nodeapi function, and make sure there is something there.

RE: Does not render...

Posted by starsinmypockets on January 22, 2011 at 12:47am

Because the node was being rendered by Display Suite. Now I need to figure out how to hand the themed output to DS and/or views...

Thanks for the help.

I'm not familiar with Display

Posted by handsofaten on January 22, 2011 at 1:17am

I'm not familiar with Display Suite, but integrating this module with Views would be a big step toward making it more viable for the general public.

Rendering through views

Posted by starsinmypockets on January 22, 2011 at 3:32am

I'm new to coding, but am going to at least have a stab at this.

As I can best understand it, the approach is to create a CCK field type and attach the themed output to its field array, which would allow the imported event info to be output by Views, Display Suite, etc. It seems like this can be done without messing with the data handling code too much...

If anyone with more experience with module development wants to lend a hand, it would be appreciated.

Great module, but I too am a

Posted by mixedfeelings on March 12, 2011 at 8:13am

Great module, but I too am a newbie. has anyone had any luck integrating this with views?

Specifically, I'd like to include the $output in list of events created by a view, so that each event in the list had a row of attendee's photos and the invitation to rsvp. Every attempt to include that in my views .tpl has come up flat.

Any Ideas?

Thanks in advance!

Hi! This is really great! I

Posted by Ivo.Radulovski on February 12, 2011 at 4:19am

Hi!

This is really great! I tried the module and everything works fine except the form for submitting the RSVP - its missing.

Ive created a test event: http://drupalskills.com/content/test-event

Can somebody help me? Probably its something small...but I miss it... I use FB 6.x-3.0-rc8

Thanks for the nice work!

-----

Drupal Development by Trio Interactive

Thanks for testing this,

Posted by handsofaten on February 12, 2011 at 4:19pm

Thanks for testing this, segments. The problem is that $perm_status is not set in the template file. This is the variable that tells the module whether the user has given your FB app permission to RSVP to events. Looking at your site, it seems you haven't asked for this permission when the user first signs up for the app. Go to Admin > Site building > Facebook Applications > List. Edit your application, and look under Facebook Extended Permissions. You want to check RSVP.

I, for one, would really

Posted by pribeh on December 30, 2010 at 11:46pm

I, for one, would really appreciate that handsofaten. I have a site that I could begin testing it with almost immediately. I'm also actually planning on migrating the site over to Drupal for Facebook (considering the greater complexity it allows for).

Thomas

Amazing stuff

Posted by Exploratus on January 4, 2011 at 6:58am

Would be really cool.

Sooo Close!

Posted by jbergeron on March 9, 2011 at 8:55pm

Hello gang,

First of all, excellent work by all of you in pulling this together. I didn't expect to find it.

I have getting an error when I create and try to view a node that was created using the field_fbeid CCK text field.
Everything seems to have installed smoothly, I set up my app and got my API key but I receive the following error:

Fatal error: Call to undefined function dpm() in /XXXX/drupal-6.14/sites/all/modules/fb/fb.module on line 455

Any thoughts? I have all of the following activated according to the readme
-- Facebook API
-- Facebook Apps
-- Facebook Connect
-- User Management
-- Extended Permissions

thanks!
Jeff

Devel module

Posted by derekahmedzai on March 9, 2011 at 9:02pm

That's function is part of the devel module, and prints variables to the screen.
You could enable the devel module (http://drupal.org/project/devel) or comment out that line.

thanks

Posted by jbergeron on March 9, 2011 at 9:10pm

Thank you. The word "debug" on that line should have tipped me off. That did clear it up.

Update for latest Drupal for Facebook module

Posted by Fr0s7 on April 20, 2011 at 5:23am

If you have updated to a recent version of the Drupal for Facebook module (such as 6.x-3.0-rc11), you might be getting an error like this:

Fatal error: Call to undefined function fb_access_token() in /sites/all/modules/handsofaten-fb-events-9af22ee/fbconnect_events.module on line 217

This is because the Drupal for Facebook module has re-named the fb_access_token() function to fb_get_token(); Therefore, you have to change the Facebook Connect Events module to match.

Open up 'fbconnect_events.module', go to line 217, and change this...
$members = $fb->api('/'.$eid.'/attending', array('access_token' => fb_access_token($fb)));

... to this...
$members = $fb->api('/'.$eid.'/attending', array('access_token' => fb_get_token($fb)));

This got me up and running again. Love this module! :)

  • Frost Simula

Is there any reason this

Posted by willvincent on May 23, 2011 at 6:47pm

Is there any reason this isn't a contrib on drupal.org? Seems like there's a good deal of interest in it. I'd be willing to help maintain it if that's a concern.

Nice to have an issue queue

Posted by Fr0s7 on May 27, 2011 at 7:17pm

I use this module, and I'm okay at tracking down where things are breaking in most modules... even if I'm not familiar with how to fix them. For me, one of the biggest reasons to make this an actual contrib project is so we can track and document separate issues, rather than keeping them all in this thread.

  • Frost Simula

You can submit it

Posted by BManuel on July 11, 2011 at 3:14am

Hi,
I guess since no one has submitted it as a contrib module, maybe just ask for permission to do that?
I doubt their will be any resistance to that idea :).
Looks like a really useful module and should not be allowed to rot away somewhere in
the dark.
BM

Do it!

Posted by handsofaten on July 26, 2011 at 3:57am

As far as I'm concerned, yes, please do. I won't have time to develop this much more for a while, but I'd be really happy to see someone get some use out of it. I think just updating it for Drupal 7 and moving the output to a block would make it a fairly useful module. Good luck!

Good share. I have Drupal 7

Posted by vinoth.3v on July 25, 2011 at 9:11pm

Good share.

I have Drupal 7 version of this module.

Vinoth - வினோத்
Tamilnanbargal.com

Please share :)

Posted by bogdan.racz on July 27, 2011 at 9:02am

Hello there,

Can you please share a development version of the module for Drupal 7.
I'm am really interested in using it and further develop.

Thanks a lot

HI Drupal 7 version of this

Posted by vinoth.3v on August 4, 2011 at 3:33pm

HI

Drupal 7 version of this module is available at http://drupal.org/project/fb_event

I like to add someone as maintainer. please see http://drupal.org/node/1239480

Vinoth - வினோத்
Tamilnanbargal.com

D6 > Don't get no data

Posted by adrianalbisser on October 9, 2013 at 11:11pm

I can't figure out to get this working on my site. I followed the readme.txt and set the module and the permissions as it should be. But by adding an CCK-field all I get back is the eid-number:
Facebook: 315726201895566
It seems like the connection to FB doesn't work. Has anyone else experienced similar problems?
I'm running D6 with all modules up to date.

Facebook API

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week

AltStyle によって変換されたページ (->オリジナル) /