Jump to content

silvestro

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by silvestro

  1. I have the same issue, no FB Events displaying since the new Facebook API updates. However, I found a temporary workaround:

     

    Temporary Workaround to make Facebook-Events module work again

    Cons:

    • unclear future support
    • needs manual token generation every two months
    • needs small change in module

    Pro:

    • it works, at least for now ?

    This solution uses an extended custom User Access Token instead of the Access Token created by the module.

    Step 1

    Go to https://developers.facebook.com/tools/explorer and choose the app you’ve created. Click on Get Token -> Get User Access Token. Uncheck all permissions, especially user_friends (this was selected by default for me) since the API changes need apps to be reviewed by Facebook to grant access to this. Check only the pages_show_list permission! Click on Get Access Token. Now, a generated Access Token should appear in the Access Token field.

    You can test if this token works by testing the following api syntax (empty field under Access Token field): 

    your-page-id/events/?fields=id,name,timezone,start_time,end_time,description,place,cover

    Replace your-page-id with your actual page id. You should get a JSON with all your page events in the response field.

    Step 2

    By default, this generated token is only valid for a few hours. To change this, click on the blue round Info-button next to the Access Token. Click Open in Access Token Tool. In the Access Token Tool, click on Extend Access Token. Now, your Access Token should be valid for two months. After that, you have to repeat this process!

    Step 3
    By default, in the Facebook-Events module settings (admin/module/edit?name=FacebookEvents), the config field for the Facebook Access Token is hidden. To change that, go to the FacebookEventsConfig.php file of the module, and on line 74, comment out the following line:

    ...
    ...
    $field->collapsed = Inputfield::collapsedHidden; // COMMENT OUT THIS LINE!
    ...

    Upload the modified FacebookEventsConfig.php file and refresh the Facebook-Events module settings. Now, the Facebook Access Token field should be visible. Replace this Access Token with the one you generated before! Now, everything should work again.

    -----------------------------------------------------------------

    Please let me know if this worked for you. Let's see how long this will continue to work ?

    Also, when using this method, don't forget to renew your Access Token every two months!

    If somebody is able to modify the module to solve this programmatically, that would be awesome!

    • Like 1
  2. @abdus this was it - thank you so much!!!

    The pages were being created with the same url "evname" - therefore at the second time, at the check if it exists it skipped the rest.

    It's really entertaining how your mind is fixated on a cause for the problem that you don't think of the obvious :D

     

    Thank you for your other comments regarding cleaner code! :-)

  3. Hello all,

    I thought quite some time about this, and maybe it might be my basic (mis-)understanding of php, but I still can't get over the following scenario:

    I'm trying to create multiple pages via code in a foreach loop, but after the save() function the loop seems to stop.

    <?php
    	foreach ($events as $event) {
    		$evName = str_replace(' ', '-', $event['name']);
    		$evName = str_replace('#', '', $evName);
    		$evName = preg_replace( "/\r|\n/", "", $evName );
    		$evName = strtolower($evName);
    		
    		$p = $pages->get("/events/$evName/");
    		if (!$p->id) {
    			$p = new Page();
    			$p->template = 'basic-page';
    			$p->parent = '/events/';
    			$p->name = '$evName';
    		}
    		$p->of(false);
    		$p->title = $event['name'];
    
    		echo ('Done: ' . $evName); // I added this for debugging. It echoes only once!
    		$p->save(); // If this is commented out, 'Done' + Event Name echoes for each Event!
    	}
    ?>

    Running this code, the first page for the $events-array is created, so that part seems to be working at least! :D

    But, somehow the foreach loop seems to stop when the page is saved and the rest of the pages isn't created. Am I missing something crucial here?

     

    Thank you for any suggestion!

  4. This may be a dumb question, but how do I get past events?

    With normal usage I just get the future events, but when I modify the module at the getEvents() function and set the $sinceDate to 0, I get all past events aswell.

    Am I missing an implemented solution intended by @justb3a?

×
×
  • Create New...