FacebookEvents by justb3a

ProcessWire module to get Facebook Page Events using the Graph API.

WARNING: This repository is no longer maintained

This repository will not be updated. The repository will be kept available in read-only mode.

ProcessWire FacebookEvents

ProcessWire module to get Facebook Page Events using the Graph API.

Create an app on Facebook developers website


You have to create an app to get appId and appSecret. Those keys are required.
Go to Facebook Developers and add a new app.
Congrats! Now you can copy your Facebook appId and appSecret.

Get your Facebook page ID


You can either enter your facebook page ID or the facebook page name.
If you enter the Facebook page name, this module will get the page ID for you!

Call Module


$events = $modules->get('FacebookEvents')->getEvents();

Output Events


echo "<ul>";
foreach ($events as $event) {
  echo "<li>{$event['name']}</li>";
}
echo "</ul>";
{% for event in events|reverse %}
  {% if event.start_time|date('U') > date().timestamp %}
    <div>
      {% set dts = modules.get('FacebookEvents').getDates(event) %}
      <a href="https://www.facebook.com/events/{{event.id}}/" title="Facebook">{{dts.dates}}:</a>
      {{event.name}} <em>{{dts.times}}</em>
    </div>
  {% endif %}
{% endfor %}

Format / Combine Start and End Date


$dts = $modules->get('FacebookEvents')->getDates($event);

Parameter:

paramtyperequireddefaultdescription
$eventarraytrue/current event (loop)
$formatDatestringfalsed.m.Ydate format
$formatTimestringfalseH:itime format
$dividerstringfalse-date / time separator

Result:

array with keys:

  • dates
  • times

Example Output:

<!-- one-day event -->
<div>
  <a href="https://www.facebook.com/events/xxx/" title="xxx">07.01.2017:</a>
  event title <em>12:00 - 16:00Uhr</em>
</div>

<!-- multi-day event -->
 <div>
  <a href="https://www.facebook.com/events/xxx/" title="xxx">01.07.2017 - 02.07.2017:</a>
  another event title <em>09:30 - 17:00</em>
</div>

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Twitter updates

  • This week we focus in on a new and unique Inputfield module added to the core that enables a lot of useful new input capabilities for tags, sortable multiple selection and custom user input— More
    30 April 2021
  • With more than 25 commits, ProcessWire 3.0.176 resolves lots of minor issues, adds support for multiple randomly selected read-only database connections, upgrades the tag features in the Template editor, adds a useful new Tags Inputfield, and more… More
    23 April 2021
  • This week ProcessWire (3.0.175) gained the ability to maintain separate read-only and read-write database connections to optimize scalability, cost and performance. The post covers why this can be so valuable and how to configure it in ProcessWire— More
    2 April 2021

Latest news

  • ProcessWire Weekly #364
    In the 364th issue of ProcessWire Weekly we'll introduce ProcessWire 3.0.177, check out a couple of new third party modules, and more. Read on!
    Weekly.pw / 1 May 2021
  • ProcessWire 3.0.177 core updates
    This week we focus in on a new and unique Inputfield module added to the core that enables a lot of useful new input capabilities for tags, sortable multiple selection and custom user input.
    Blog / 30 April 2021
  • Subscribe to weekly ProcessWire news

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull