About Facebook Events

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

Category 1Markup Generation
Markup modules that are called upon to generate or parse markup (like HTML). Markup modules are most often used on the front-end of a site (rather than admin).
Category 2Social, Feeds, Services
Modules that provide or work with social networking services and/or external feeds.
Release StateBeta
Close to stable, but users are advised to be cautious and test thoroughly.*
Authorjustb3a
Module Version0.0.1
Class NameFacebookEvents
Compatibility3.0
Date AddedMarch 10, 2017
Last UpdatedMarch 15, 2017
Recommended ByNew recommendations may take up to 1 day to appear.

Instructions

This module's files should be placed in /site/modules/FacebookEvents/
How to install or uninstall modules

README

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

{% 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>

Comments

No comments yet. Be the first to post!

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.