3rd May 2024 - With assistance form Robbie J, the module is now Joomla 5 Compatible at version 5.3.1.
5th January 2021 - The bug in Google Chrome is now fixed for Windows 11,10, and 8.
Sadly Chrome no longer upgrade for Windows 7 - so that remains broken.
We upgraded the tdocplus.co.uk domain to https: This has NOT broken the upgrade links for the extension - which work fine.
Report of 4th September - still at version 4.2.3. A probable bug in Google Chrome ! Noted as follows:
- Firefox [Version 104.0.2 - 64bit] shows the embedded Facebook page perfectly. [Windows 7, 8, and 10]
- Opera [Version 90.0.4480.54 - 64bit] also shows the embedded Facebook page perfectly. [Windows 7, 8, and 10]
- Google Chrome [Version 49.0.2623.112] again shows the embedded Facebook page perfectly. [Windows XP]
- However, Google Chrome [Version 105.0.5195.102 (Official Build) (64-bit)] starts to load the embedded page, and after showing the header fails to load the actual Facebook page. [Windows 7, 8, and 10] Bug reported to Google Chrome Support. Is this caused by Chrome's memory management, or by its "persistence", or what ? In fact it seems it may have something to do with Chrome's User-Agent Reduction Origin Trial. See here for which link I am greatful to research by Gérald Garlatti. Thanks !
- Facebook have updated the key function from version 9.0 to 14.0. Problem remains.
- Also noted that sometimes the content of other tabs disappears, and a reload fails.
Amazing - my first module ever .... now at version 4.3.1 as 12th March 2022 - translated ... and changed it's name to mod_tdocfbk. Installation problems resolved.
Report as at version 4.2.3 of 9th May 2021:
Still having some problems with the installer. Frankly the documentation published by Joomla is simply inadequate. One thing is that in the <version> tag, do not have any white spaces before or after the version. Now all sorted out.
Tested on several of my Joomla 3 and 4. sites, e.g http://www.parkdavidson.co.uk/ [now 4.1.0], and http://unaccountablescotland.org.uk/ [now 3.10.6]
Note: In J4 using the Cassiopeia template, the display is best described as near perfect.
In J3 using the Protostar template, some css is required to improve the look - the margins and borders need to be thinned down, etc. But frankly this is beyond my powers !
Instructions and configuration
Install the module - it is called TDOC Facebook Display in the usual manner.
You do not need to set up a menu item, just create a module, and select a position for it. A Sidebar is suggested. No position means nothing will show up.
You can turn the Title "TDOC Facebook Display" off using the setting just above the Position.
If that is successful, the it must be configured. There are eight settings as follows:
- Base URL. The address of your facebook page e.g. https://www.facebook.com/LinnPark
- Show Posts - defaults to "Yes". Suggested that you use this.
- Show Faces - defaults to "Yes". Up to you.
- Hide Cover Photo - defaults to "No". Up to you.
- Small Header - defaults to "Yes". Up to you.
- Number of Connections - defaults to 25 - suggested by Facebook.
- Width - defaults to 300. Suggest that you use the right or left sidebar positions, but up to you.
- Height - defaults to 700. See 7 above.
Do NOT forget to set the menu assignment - otherwise it will not show up.
3rd May 2024. Thanks to RobbieJ https://forum.joomla.org/viewtopic.php?f=833&t=1008461 the Facebook Module is now J5 compatible, so it will not work on Joomla 3 and 4 sites. The J4 version is available here: https://tdocplus.co.uk/tdoc_j4_dev/tdoc_fbk/431_tdocfbk.zip.
The modifications to the code are shown below in red updated 4th May 2024.
Overview of changes
The changes are mainly sematic in that the calling stcture has been overhauled, noted in particular:
- No php code changes are required,
- The "helper system" has been overhauled,
- The system to "set up joomla" has been overhauled,
- The "namespace" has been added [it appears this will be needed for Joomal 6].
The original source code and structure [updated 16th March 2022] follows.
Structure of "mod_tdocfbk"
Files as follows:
- In the "root" directory:
- index.html
- helper.php
- mod_tdocfbk.php
- mod_tdocfbk.xml
- a new directory called "src"
- a new sub-directory called "Helper"
- TdocfbkHelper.php [was helper.php]
- TdocfbkHelper.php [was helper.php]
- a new sub-directory called "Helper"
- In the "tmpl" sub-directory
- index.html
- default.php
- In the "language" sub-directory
- another sub-directory called en-GB[case sensitive]
- mod_tdocfbk.ini
- mod_tdocfbk.sys.ini
- another sub-directory called en-GB[case sensitive]
- In the "upgrade" server
- mod_tdoc_fbk.zip [all of the above zipped]
- mod_tdoc_fbk_update.xml
Content of files and notes - all names in lower case
a) index.html [root and tmpl] Note: Needs to be added to src
Purpose: a simple security feature - anyone tries a directory - gets nothing.
Content: <html><body bgcolor="#FFFFFF"></body></html>
b) helper.php [root]
Renamed and moved into the src directory
Purpose: Instantiates the helper class ...
Content:
<?php
/**
*** @package TDOC Facebook Display
* @copyright Copyright (C) 2021. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-3.0.html
* @version 4.3.1 of 12th March 2022 5.3.1 of 26th April 2024
**/
/**
* Modified per robbiej - https://forum.joomla.org/viewtopic.php?f=833&t=1008461
* File renamed as TdocfbkHelper.php from helper.php
* File moved from Root to \src\Helper
**/
/** added namespace call **/
namespace Tdoc\Module\Tdocfbk\Site\Helper;
defined('_JEXEC') or die('Restricted access');
/** class renamed from mod_tdocfbkhelper **/
class mod_tdoc_fbkhelper {}
class TdocfbkHelper { }
?>
c) mod_tdocfbk.php [root]
Purpose: loads the helper class, and gets the layout path.
Content:
<?php
/**
* @package TDOC Facebook Display
* @copyright Copyright (C) 2021. All rights reserved.
* @license http://www.gnu.org/licenses/quick-guide-gplv3.html
* @version 4.3.1 5.3.1
**/
// see https://docs.joomla.org/J3.x:Creating_a_simple_module/Developing_a_Basic_Module
// no direct access
defined('_JEXEC') or die('Restricted access');
/** new code **/
use Joomla\CMS\Helper\ModuleHelper;
/** deleted code **/
// Include the syndicate functions only once
require_once __DIR__ . '/helper.php';
/** modified code **/
/** require JModuleHelper::getLayoutPath('mod_tdocfbk'); **/
require ModuleHelper::getLayoutPath('mod_tdocfbk');
?>
d) mod_tdocfbk.xml [root]
Purpose: the installer.
Content:
Nota Bene: The Joomla 4 version of the spacer fields is given. These throw a non fatal error in J3.9.xx.
<?xml version="1.0" encoding="utf-8"?>
<!-- Standard Data provided. -->
<extension type="module" method="upgrade" client="site">
<name>MOD_TDOCFBK</name>
<author>TDOC</author>
<creationDate>12th March 2022</creationDate>
<copyright>Copyright (C) 2022 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html</license>
<authorEmail>
<authorUrl>www.rgtr.tdocplus.co.uk</authorUrl>
<version>4.3.15.3.1</version>
<description>MOD_TDOCFBK_XML_DESCRIPTION</description>
<!-- added namespace -->
<namespace path="src">Tdoc\Module\Tdocfbk</namespace>
<!-- Language & tmpl files as well -->
<files>
<filename module="mod_tdocfbk">mod_tdocfbk.php</filename>
<filename>mod_tdocfbk.xml</filename>
<filename>index.html</filename>
<!-- added new folder for helper file -->
<folder>src</folder>
<filename>helper.php</filename>
<folder>tmpl</folder>
<folder>language</folder>
</files>
<!-- xml file that holds the update information -->
<!-- decided to leave the directory named ".._j4_.." -->
<updateservers>
<server type="extension" name="mod_tdocfbk_updates">http://wwww.tdocplus.co.uk/tdoc_j4_dev/tdoc_fbk/mod_tdocfbk_update.xml</server>
</updateservers>
<!-- Setup the form for the Basic tab -->
<config>
<fields name="params" addpath="/modules/mod_tdocfbk/elements">
<fieldset name="basic">
<!-- hidden fields -->
<field name="apikey" type="text" default="192044219335632" label="" description="" />
<!-- url field -->
<field type="spacer" name="mandatory" /label="MOD_TDOCFBK_MANDATORY" >
<field name="facebook_url" type="text" default="" label="MOD_TDOCFBK_BASE_URL" description="MOD_TDOCFBK_BASE_URL_DESC" size="50" />
<!-- configuration fields -->
<field type="spacer" name="Configuration" label="MOD_TDOCFBK_CONFIGURATION" />
<field name="stream" type="list" default="true" label="MOD_TDOCFBK_SHOW_POSTS" description="MOD_TDOCFBK_SHOW_POSTS_DESC">
<option value="true">MOD_TDOCFBK_YES</option>
<option value="false">MOD_TDOCFBK_NO</option>
</field>
<field name="show_faces" type="list" default="false" label="MOD_TDOCFBK_SHOW_FACES" description="MOD_TDOCFBK_SHOW_FACES_DESC">
<option value="true">MOD_TDOCFBK_SHOW</option>
<option value="false">MOD_TDOCFBK_HIDE</option>
</field>
<field name="hide" type="list" default="false" label="MOD_TDOCFBK_HIDE_COVER" description="MOD_TDOCFBK_HIDE_COVER_DESC">
<option value="true">MOD_TDOCFBK_YES</option>
<option value="false">MOD_TDOCFBK_NO</option>
</field>
<field name="small_header" type="list" default="true" label="MOD_TDOCFBK_SMALL_HEADER" description="MOD_TDOCFBK_SMALL_HEADER_DESC">
<option value="true">MOD_TDOCFBK_YES</option>
<option value="false">MOD_TDOCFBK_NO</option>
</field>
<field name="connections" type="text" default="25" label="MOD_TDOCFBK_CONNECTIONS" description="MOD_TDOCFBK_CONNECTIONS" />
<!-- dimension fields -->
<field type="spacer" name="MOD_TDOCFBK_DIMENSIONS" />
<field name="width" type="text" default="300" label="MOD_TDOCFBK_WIDTH" description="MOD_TDOCFBK_WIDTH_DESXC" />
<field name="height" type="text" default="700" label="MOD_TDOCFBK_HEIGHT" description="MOD_TDOCFBK_HEIGHT_DESC" />
</fieldset>
</fields>
</config>
</extension>
On installation Joomla creates a record is created in the _modules table, and the above config data, in the form "descriptor":"value", is stored in the "params" field as an array. It also adds the advanced data - the last four pairs - viz:
{
"apikey":"192044219335632",
"facebook_url":"https:\/\/www.facebook.com/LinnPark", [or similar after edit]
"stream":"true",
"show_faces":"false",
"hide":"false",
"connections":"25",
"width":"300",
"height":"600",
"style":"0",
"module_tag":"div",
"bootstrap_size":"0",
"header_tag":"h3",
"header_class":""
}
e) default.php - where the action takes place !
Purpose: the operational module - gets parameters from _modules, logs onto facebook, and displays page.
Content:
<?php
/**
* @package TDOC Facebook Display
* @copyright Copyright (C) 2021. All rights reserved.
* @license http://www.gnu.org/licenses/quick-guide-gplv3.html
*
**/
// No direct access
defined('_JEXEC') or die('Restricted access');
/** new code **/
use Joomla\CMS\Factory;
/** updated code **/
$doc = JFactory::getDocument();
$doc = Factory::getDocument();
/** hidden text fields passed in xml **/
/** $moduleclass_sfx = $params->get('moduleclass_sfx'); not needed **/
$apikey = $params->get('apikey');
/** facebook settings **/
$baseurl = $params->get('facebook_url','null');
$stream = $params->get('stream');
$show_faces = $params->get('show_faces',false);
$hide_cover = $params->get('hide');
$small_header = $params->get('small_header',true);
$connections = $params->get('connections');
/** dimensions **/
$width = $params->get('width',350);
$height = $params->get('height',700);
?>
<!-- https://stackoverflow.com/questions/12743856/clicking-the-like-in-the-website-should-like-in-facebook
5th September 2022 - Updated version to 14.0
-->
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v14.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
f) language files [see article on Translating]
;; TDOC FBK
;; Ver 4.3.1 of 12th March 2022
;; Language file for Options: mod_tdocfbk.sys.ini
MOD_TDOCFBK="TDOC Facebook Display"
MOD_TDOCFBK_XML_DESCRIPTION="Display a Facebook Page<br>Version 4.3.1 dated 12th March 2022 for Joomla 3.10 and 4.1"
;; TDOC FBK
;; Ver 4.3.1 of 12th March 2022
;; Language file for Options: mod_tdocfbk.ini
MOD_TDOCFBK="TDOC Facebook Display"
MOD_TDOCFBK_XML_DESCRIPTION="Display a Facebook Page<br>Version 4.3.1 dated 12th March 2022 for Joomla 3.10 and 4.1"
MOD_TDOCFBK_MANDATORY="<b>Mandatory</b>"
MOD_TDOCFBK_BASE_URL="Facebook page"
MOD_TDOCFBK_BASE_URL_DESC="The full url of the facebook page to be dispayed"
MOD_TDOCFBK_CONFIGURATION="<b>Configuration</b>"
MOD_TDOCFBK_SHOW_POSTS="Show Posts"
MOD_TDOCFBK_SHOW_POSTS_DESC="Whether to show facebook posts - Default is YES"
MOD_TDOCFBK_SHOW_FACES="Show Faces"
MOD_TDOCFBK_SHOW_FACES_DESC="Whether to show faces of posters - Default is HIDE"
MOD_TDOCFBK_HIDE_COVER="Hide Cover Photo"
MOD_TDOCFBK_HIDE_COVER_DESC="Whether to hide the cover photo or not - Default is NO"
MOD_TDOCFBK_SMALL_HEADER="Small Header"
MOD_TDOCFBK_SMALL_HEADER_DESC="Make the header small in size - Default is YES"
MOD_TDOCFBK_CONNECTIONS="Number of Connections"
MOD_TDOCFBK_CONNECTIONS_DESC="Total number of simulaneous connections - Facebook recommend 25"
MOD_TDOCFBK_DIMENSIONS="<b>Dimensions</b>"
MOD_TDOCFBK_WIDTH="Width"
MOD_TDOCFBK_WIDTH_DESC="Recommended width is 300"
MOD_TDOCFBK_HEIGHT="Height"
MOD_TDOCFBK_HEIGHT_DESC="Recommended height is 700"
MOD_TDOCFBK_NO="No"
MOD_TDOCFBK_YES="Yes"
MOD_TDOCFBK_HIDE="Hide"
MOD_TDOCFBK_SHOW="Show"
Purpose: the actual installation package to be uploaded and installed.
<?xml version="1.0" encoding="utf-8"?>
<updates>
<update>
<name>mdoc_tdoc_fbk</name>
<description>Facebook Display</description>
<element>mod_tdoc_fbk</element>
<type>module</type>
<client>0</client>
<version>4.2.15.3.1</version>
<infourl title="tdoc">http://www.tdocplus.co.uk</infourl>
<downloads>
<downloadurl type="full" format="zip">http://www.tdopclus.co.uk/tdoc_j4_dev/tdoc_fbk/mod_tdoc_fbk.zip</downloadurl>
</downloads>
<tags>
<!-- dev, alpha, beta, rc, stable -->
<tag>beta</tag>
</tags>
<maintainer>Eur Ing Richard Townsend_Rose</maintainer>
<maintainerurl>http://www.rgtr.tdocplus.co.uk</maintainerurl>
<targetplatform name="joomla" version="45.*"/>
<php_minimum>7.28.1</php_minimum>
<!--
load WindowsPowerShell using RUN window
certutil -hashfile R:\5_Web_Sites_etc\0_J4_Devs\mod_tdoc_fbk\mod_tdoc_fbk.zip SHA256
"mark" the displayed answer, press return which copies to clipboard
-->
<!-- <sha256>?????</sha256> -->
</update>
</updates>