Question

I need to display all Facebook events inside a group. I know the group id and the creator id but I am unable to display them.

I always get NULL values in the return, as if they don't exist. How can I get this code to work?

  • The group is public
  • I want to display the events on a external page even if the user is not logged in so every visitor sees the events of this group.

Code:

facebook = new Facebook(
    array('appId' => $this -> params -> get('appid'), 
          'secret' => $this -> params -> get('secret'), 
          'cookie' => true, // enable optional cookie support
         )
    );

// Get the current access token
$access_token = $facebook->getAccessToken();

$fql = "SELECT name, pic, eid, start_time, end_time, location, description, update_time from event WHERE creator=XXXXXXXXXXX and eid IN ( SELECT eid FROM event_member WHERE uid = " . $this -> params -> get('idfbpage') . ")";    

$fqlResult = $facebook -> api($param);

Returns null lines, even all the events created by that creator would be OK assuming that they create events ONLY for this group.

Was it helpful?

Solution

Did you try with the Graph API?

/[group-id]/events

I just tried it, and it delivers me all the events from a group, i also get older ones. You can also get the owner of the event easily:

/[group-id]/events?fields=owner

You can do this with just an app access token, which is created like this:

$access_token = FBAPPID . '|' . FBSECRET;

If there is a solution with the Graph API, you should always go for it. FQL is a pain.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top