Custom Facebook Feed - Version 2.5.2

Version Description

  • Important: Due to sudden changes in the Facebook API it is no longer possible to display posts from a Facebook Group. Please see here for more information. We apologize for any frustration or inconvenience this has caused.
  • Removed: Due to Facebook API restrictions, it is no longer possible to display information about an event when it is posted or shared to your Facebook Page timeline.
Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Custom Facebook Feed
Version 2.5.2
Comparing to
See all releases

Code changes from version 2.5.1 to 2.5.2

README.txt CHANGED
@@ -1,13 +1,13 @@
1
=== Custom Facebook Feed ===
2
Contributors: smashballoon
3
- Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook group
4
Requires at least: 3.0
5
Tested up to: 4.9
6
- Stable tag: 2.5.1
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
10
- The Custom Facebook Feed allows you to display completely customizable Facebook feeds of any public Facebook page or group on your website
11
12
== Description ==
13
@@ -24,7 +24,7 @@ Display a **completely customizable**, **responsive** and **search engine crawla
24
* **Completely Customizable** - By default the Facebook feed will adopt the style of your website, but can be completely customized to look however you like - with tons of styling and customization options!
25
* Facebook feed content is **crawlable by search engines** adding SEO value to your site - other Facebook plugins embed the feed using iframes which are not crawlable
26
* Completely **responsive** and mobile optimized - layout looks great on any screen size and in any container width
27
- * Display **feeds from multiple different Facebook pages/groups** and use the shortcode to embed them into a page, post or widget anywhere on your site
28
* Show **events** from your Facebook feed with name, date/time, location and description
29
* Add your own **custom CSS**
30
* **Caching** means that your Facebook posts load lightning fast. Set your own caching time - check for new posts on Facebook every few seconds, minutes, hours or days. You decide.
@@ -54,7 +54,7 @@ In order to maintain the free version of the plugin on an ongoing basis, and to
54
55
= Benefits of the Custom Facebook Feed plugin =
56
57
- * **Increase social engagement** between you and your users, customers, fans or group members
58
* **Save time** by using the Custom Facebook Feed to generate dynamic, search engine crawlable content on your website
59
* **Get more likes** by displaying your Facebook content directly on your site
60
* **Improve your SEO** as all of that quality keyword-rich Facebook content from posts and comments is directly embedded into your website
@@ -76,29 +76,29 @@ In order to maintain the free version of the plugin on an ongoing basis, and to
76
77
For a full list of FAQs and help with troubleshooting please visit the **[FAQ & Troubleshooting](https://smashballoon.com/custom-facebook-feed/faq/)** section of the Smash Balloon website
78
79
- = How do I find the Page ID of my Facebook page or group? =
80
81
If you have a Facebook **page** with a URL like this: `https://www.facebook.com/smashballoon` then the Page ID is just `smashballoon`. If your page URL is structured like this: `https://www.facebook.com/pages/smashballoon/123654123654123` then the Page ID is actually the number at the end, so in this case `123654123654123`.
82
83
- If you have a Facebook **group** then use [this tool](http://lookup-id.com/ "Look Up my ID") to find your Group ID.
84
85
Copy and paste the ID into the [Pro demo](https://smashballoon.com/custom-facebook-feed/demo/) to test it.
86
87
= Are there any limitations on which Facebook page or group feeds I can display? =
88
89
- The Facebook feed you're trying to display has to be from a publicly accessible Facebook page or group. This means that you can't display the feed from your own personal Facebook profile or private Facebook group. This is to do with Facebook's privacy policies. You can't display a non-public Facebook feed publicly.
90
91
If your Facebook page has any restrictions on it (age, for example) then it means that people have to be signed into Facebook in order to view your page. This isn't desirable for most Facebook pages as it means that it isn't accessible by people who don't have a Facebook account and that your Facebook page can't be crawled and indexed by search engines.
92
93
An easy way to determine whether your Facebook page is set to public is to sign out of your Facebook account and try to visit your page. If Facebook forces you to sign in to view your page then it isn't public. You can change your Facebook page to public in your Facebook page settings simply by removing any age or location restrictions you have on it ([screenshot](https://smashballoon.com/wp-content/uploads/2013/06/facebook-page-restrictions.png)), which will then allow the Custom Facebook Feed plugin to access and display your feed.
94
95
- = Can I display feeds from multiple Facebook pages or groups? =
96
97
You can set your default Facebook Page ID on the Custom Facebook Feed settings page within the WordPress admin, you can then define different page IDs in the shortcodes you use to show multiple feeds from different Facebook pages. Just use the id option in your shortcode like so: [custom-facebook-feed id=another_page_id]. You can use as many shortcodes as you like with as many different IDs as you like.
98
99
= Can I display the feed from a personal Facebook profile? =
100
101
- Due to Facebook's privacy policy you're not able to use the plugin to display all of your posts from a personal profile, only from a public page or group, as posts from a personal profile are protected for privacy reasons. You may have limited success in displaying certain posts from a personal profile but most posts are not able to be displayed.
102
103
If you're using the profile to represent a business, organization, product, public figure or the like, then we'd advise converting your profile to a page per [Facebook's recommendation](http://www.facebook.com/help/175644189234902/), as there are many advantages to using pages over profiles.
104
@@ -218,7 +218,7 @@ You no longer need your own Access Token to use the Custom Facebook Feed Plugin,
218
219
**1)** Go to [developers.facebook.com](http://developers.facebook.com "Facebook developers website") and click on Log In in the top right. Log in using your personal Facebook credentials.
220
221
- **Note:** The personal Facebook account that you use to register as a Facebook developer does not need to be associated in any way with the Facebook page or Facebook group whose posts you want to display. You can use the Facebook Access Token you receive to display the Facebook posts from any public Facebook page or open Facebook group.
222
223
**Note:** You cannot log in to the Facebook Developer site using a Facebook Page or Facebook Business account. You must use the username and password from your personal Facebook profile. Facebook doesn't allow businesses to register as Facebook developers, only individuals.
224
@@ -265,6 +265,10 @@ You no longer need your own Access Token to use the Custom Facebook Feed Plugin,
265
266
== Changelog ==
267
268
= 2.5.1 =
269
* Fix: Prevented a PHP notice which would be displayed under rare circumstances
270
* Fix: Replaced a function due to a deprecation in PHP 7.2
1
=== Custom Facebook Feed ===
2
Contributors: smashballoon
3
+ Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook page
4
Requires at least: 3.0
5
Tested up to: 4.9
6
+ Stable tag: 2.5.2
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
10
+ The Custom Facebook Feed allows you to display completely customizable Facebook feeds of any public Facebook page on your website
11
12
== Description ==
13
24
* **Completely Customizable** - By default the Facebook feed will adopt the style of your website, but can be completely customized to look however you like - with tons of styling and customization options!
25
* Facebook feed content is **crawlable by search engines** adding SEO value to your site - other Facebook plugins embed the feed using iframes which are not crawlable
26
* Completely **responsive** and mobile optimized - layout looks great on any screen size and in any container width
27
+ * Display **feeds from multiple different Facebook pages** and use the shortcode to embed them into a page, post or widget anywhere on your site
28
* Show **events** from your Facebook feed with name, date/time, location and description
29
* Add your own **custom CSS**
30
* **Caching** means that your Facebook posts load lightning fast. Set your own caching time - check for new posts on Facebook every few seconds, minutes, hours or days. You decide.
54
55
= Benefits of the Custom Facebook Feed plugin =
56
57
+ * **Increase social engagement** between you and your users, customers, or fans
58
* **Save time** by using the Custom Facebook Feed to generate dynamic, search engine crawlable content on your website
59
* **Get more likes** by displaying your Facebook content directly on your site
60
* **Improve your SEO** as all of that quality keyword-rich Facebook content from posts and comments is directly embedded into your website
76
77
For a full list of FAQs and help with troubleshooting please visit the **[FAQ & Troubleshooting](https://smashballoon.com/custom-facebook-feed/faq/)** section of the Smash Balloon website
78
79
+ = How do I find the Page ID of my Facebook page? =
80
81
If you have a Facebook **page** with a URL like this: `https://www.facebook.com/smashballoon` then the Page ID is just `smashballoon`. If your page URL is structured like this: `https://www.facebook.com/pages/smashballoon/123654123654123` then the Page ID is actually the number at the end, so in this case `123654123654123`.
82
83
+ Due to [recent changes](https://smashballoon.com/facebook-api-changes-april-4-2018/) to the Facebook API it is unfortunately no longer possible to display a feed from a Facebook Group.
84
85
Copy and paste the ID into the [Pro demo](https://smashballoon.com/custom-facebook-feed/demo/) to test it.
86
87
= Are there any limitations on which Facebook page or group feeds I can display? =
88
89
+ The Facebook feed you're trying to display has to be from a publicly accessible Facebook page. This means that you can't display the feed from your own personal Facebook profile or Facebook group. This is to do with Facebook's privacy policies. You can't display a non-public Facebook feed publicly.
90
91
If your Facebook page has any restrictions on it (age, for example) then it means that people have to be signed into Facebook in order to view your page. This isn't desirable for most Facebook pages as it means that it isn't accessible by people who don't have a Facebook account and that your Facebook page can't be crawled and indexed by search engines.
92
93
An easy way to determine whether your Facebook page is set to public is to sign out of your Facebook account and try to visit your page. If Facebook forces you to sign in to view your page then it isn't public. You can change your Facebook page to public in your Facebook page settings simply by removing any age or location restrictions you have on it ([screenshot](https://smashballoon.com/wp-content/uploads/2013/06/facebook-page-restrictions.png)), which will then allow the Custom Facebook Feed plugin to access and display your feed.
94
95
+ = Can I display feeds from multiple Facebook pages? =
96
97
You can set your default Facebook Page ID on the Custom Facebook Feed settings page within the WordPress admin, you can then define different page IDs in the shortcodes you use to show multiple feeds from different Facebook pages. Just use the id option in your shortcode like so: [custom-facebook-feed id=another_page_id]. You can use as many shortcodes as you like with as many different IDs as you like.
98
99
= Can I display the feed from a personal Facebook profile? =
100
101
+ Due to Facebook's privacy policy you're not able to use the plugin to display all of your posts from a personal profile, only from a public page, as posts from a personal profile are protected for privacy reasons. You may have limited success in displaying certain posts from a personal profile but most posts are not able to be displayed.
102
103
If you're using the profile to represent a business, organization, product, public figure or the like, then we'd advise converting your profile to a page per [Facebook's recommendation](http://www.facebook.com/help/175644189234902/), as there are many advantages to using pages over profiles.
104
218
219
**1)** Go to [developers.facebook.com](http://developers.facebook.com "Facebook developers website") and click on Log In in the top right. Log in using your personal Facebook credentials.
220
221
+ **Note:** The personal Facebook account that you use to register as a Facebook developer does not need to be associated in any way with the Facebook page whose posts you want to display. You can use the Facebook Access Token you receive to display the Facebook posts from any public Facebook page.
222
223
**Note:** You cannot log in to the Facebook Developer site using a Facebook Page or Facebook Business account. You must use the username and password from your personal Facebook profile. Facebook doesn't allow businesses to register as Facebook developers, only individuals.
224
265
266
== Changelog ==
267
268
+ = 2.5.2 =
269
+ * Important: Due to sudden changes in the Facebook API it is no longer possible to display posts from a Facebook Group. Please [see here](https://smashballoon.com/facebook-api-changes-april-4-2018/) for more information. We apologize for any frustration or inconvenience this has caused.
270
+ * Removed: Due to Facebook API restrictions, it is no longer possible to display information about an event when it is posted or shared to your Facebook Page timeline.
271
+
272
= 2.5.1 =
273
* Fix: Prevented a PHP notice which would be displayed under rare circumstances
274
* Fix: Replaced a function due to a deprecation in PHP 7.2
css/cff-admin-style.css CHANGED
@@ -74,7 +74,8 @@
74
#cff-admin .cff-notice a:focus{
75
color: #a34100;
76
}
77
- #cff-admin .cff-profile-error{
78
display: none;
79
80
margin-top: 5px;
74
#cff-admin .cff-notice a:focus{
75
color: #a34100;
76
}
77
+ #cff-admin .cff-profile-error,
78
+ #cff-admin .cff-group-error{
79
display: none;
80
81
margin-top: 5px;
custom-facebook-feed-admin.php CHANGED
@@ -134,7 +134,7 @@ function cff_settings_page() {
134
<table class="form-table">
135
<tbody>
136
<tr valign="top">
137
- <th scope="row"><label><?php _e('Facebook Page ID<br /><i style="font-weight: normal; font-size: 12px;">ID of your Facebook Page or Group</i>', 'custom-facebook-feed'); ?></label><code class="cff_shortcode"> id
138
Eg: id="YOUR_PAGE_ID"</code></th>
139
<td>
140
<input name="cff_page_id" id="cff_page_id" type="text" value="<?php esc_attr_e( $page_id_val, 'custom-facebook-feed' ); ?>" size="45" />
@@ -151,7 +151,7 @@ function cff_settings_page() {
151
URL Format 3: <code>https://www.facebook.com/pages/your_page_name/<span class="cff-highlight">1234567890</span></code>
152
'); ?>
153
</li>
154
- <li><?php _e('<b>Facebook Group</b><br />If you have a Facebook <b>Group</b> then use <a href="http://lookup-id.com/" target="_blank" title="Find my ID">this tool</a> to find your ID.'); ?></li>
155
<li><?php _e('To test that your ID is correct, you can copy and paste it into our <a href="http://smashballoondemo.com/" target="_blank">Pro demo</a>.'); ?></li>
156
</ul>
157
</div>
@@ -199,8 +199,13 @@ function cff_settings_page() {
199
<option value="group" <?php if($cff_page_type_val == "group") echo 'selected="selected"' ?> ><?php _e('Group', 'custom-facebook-feed'); ?></option>
200
<option value="profile" <?php if($cff_page_type_val == "profile") echo 'selected="selected"' ?> ><?php _e('Profile', 'custom-facebook-feed'); ?></option>
201
</select>
202
<div class="cff-notice cff-profile-error cff-page-type">
203
- <?php _e("<p>Due to Facebook's privacy policy you're not able to display posts from a personal profile, only from a public page or group.</p><p>If you're using a profile to represent a business, organization, product, public figure or the like, then Facebook recommends <a href='http://www.facebook.com/help/175644189234902/' target='_blank'>converting your profile to a page</a>. There are many advantages to using pages over profiles, and once you've converted then the plugin will be able to successfully retrieve and display all of your posts.</p>", 'custom-facebook-feed'); ?>
204
</div>
205
</td>
206
</tr>
134
<table class="form-table">
135
<tbody>
136
<tr valign="top">
137
+ <th scope="row"><label><?php _e('Facebook Page ID<br /><i style="font-weight: normal; font-size: 12px;">ID of your Facebook Page</i>', 'custom-facebook-feed'); ?></label><code class="cff_shortcode"> id
138
Eg: id="YOUR_PAGE_ID"</code></th>
139
<td>
140
<input name="cff_page_id" id="cff_page_id" type="text" value="<?php esc_attr_e( $page_id_val, 'custom-facebook-feed' ); ?>" size="45" />
151
URL Format 3: <code>https://www.facebook.com/pages/your_page_name/<span class="cff-highlight">1234567890</span></code>
152
'); ?>
153
</li>
154
+ <li><?php _e('<b>Facebook Group</b><br />Due to <a href="https://smashballoon.com/facebook-api-changes-april-4-2018/" target="_blank">recent changes</a> to the Facebook API it is unfortunately no longer possible to display a feed from a Facebook Group.'); ?></li>
155
<li><?php _e('To test that your ID is correct, you can copy and paste it into our <a href="http://smashballoondemo.com/" target="_blank">Pro demo</a>.'); ?></li>
156
</ul>
157
</div>
199
<option value="group" <?php if($cff_page_type_val == "group") echo 'selected="selected"' ?> ><?php _e('Group', 'custom-facebook-feed'); ?></option>
200
<option value="profile" <?php if($cff_page_type_val == "profile") echo 'selected="selected"' ?> ><?php _e('Profile', 'custom-facebook-feed'); ?></option>
201
</select>
202
+
203
<div class="cff-notice cff-profile-error cff-page-type">
204
+ <?php _e("<p>Due to Facebook's privacy policy you're not able to display posts from a personal profile, only from a public Facebook Page.</p><p>If you're using a profile to represent a business, organization, product, public figure or the like, then Facebook recommends <a href='http://www.facebook.com/help/175644189234902/' target='_blank'>converting your profile to a page</a>. There are many advantages to using pages over profiles, and once you've converted then the plugin will be able to successfully retrieve and display all of your posts.</p>", 'custom-facebook-feed'); ?>
205
+ </div>
206
+
207
+ <div class="cff-notice cff-group-error cff-page-type">
208
+ <?php _e("<p>Due to recent changes in the Facebook API it is unfortunately not possible to display posts from Facebook Groups. Please see <a href='https://smashballoon.com/facebook-api-changes-april-4-2018/' target='_blank'>this page</a> for more information.</p>", 'custom-facebook-feed'); ?>
209
</div>
210
</td>
211
</tr>
custom-facebook-feed.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Custom Facebook Feed
4
Plugin URI: http://smashballoon.com/custom-facebook-feed
5
Description: Add completely customizable Facebook feeds to your WordPress site
6
- Version: 2.5.1
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
@@ -24,7 +24,7 @@ along with this program; if not, write to the Free Software
24
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
*/
26
27
- define('CFFVER', '2.5.1');
28
29
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
30
//Include admin
@@ -907,20 +907,30 @@ function display_cff($atts) {
907
$cff_content .= '<div class="cff-error-msg"><p>Unable to display Facebook posts.<br/><a href="javascript:void(0);" id="cff-show-error" onclick="cffShowError()">Show error</a>';
908
$cff_content .= '<script type="text/javascript">function cffShowError() { document.getElementById("cff-error-reason").style.display = "block"; document.getElementById("cff-show-error").style.display = "none"; }</script>';
909
$cff_content .= '</p><div id="cff-error-reason">';
910
-
911
- if( isset($FBdata->error->message) ) $cff_content .= 'Error: ' . $FBdata->error->message;
912
- if( isset($FBdata->error->type) ) $cff_content .= '<br />Type: ' . $FBdata->error->type;
913
- if( isset($FBdata->error->code) ) $cff_content .= '<br />Code: ' . $FBdata->error->code;
914
- if( isset($FBdata->error->error_subcode) ) $cff_content .= '<br />Subcode: ' . $FBdata->error->error_subcode;
915
916
- if( isset($FBdata->error_msg) ) $cff_content .= 'Error: ' . $FBdata->error_msg;
917
- if( isset($FBdata->error_code) ) $cff_content .= '<br />Code: ' . $FBdata->error_code;
918
-
919
- if($FBdata == null) $cff_content .= 'Error: Server configuration issue';
920
921
- if( empty($FBdata->error) && empty($FBdata->error_msg) && $FBdata !== null ) $cff_content .= 'Error: No posts available for this Facebook ID';
922
923
- $cff_content .= '<br />Please refer to our <a href="http://smashballoon.com/custom-facebook-feed/docs/errors/" target="_blank">Error Message Reference</a>.';
924
$cff_content .= '</div></div>'; //End .cff-error-msg and #cff-error-reason
925
//Only display errors to admins
926
if( current_user_can( 'manage_options' ) ){
@@ -1504,95 +1514,7 @@ function display_cff($atts) {
1504
//EVENT
1505
$cff_event_has_cover_photo = false;
1506
$cff_event = '';
1507
- if ($cff_show_event_title || $cff_show_event_details) {
1508
- //Check for media
1509
- if ($cff_post_type == 'event') {
1510
-
1511
- //Get the event id from the event URL. eg: http://www.facebook.com/events/123451234512345/
1512
- $event_url = parse_url($link);
1513
- $url_parts = explode('/', $event_url['path']);
1514
- //Get the id from the parts
1515
- $eventID = $url_parts[count($url_parts)-2];
1516
-
1517
- //Facebook changed the event link from absolute to relative, and so if the link isn't absolute then add facebook.com to front
1518
- ( stripos($link, 'facebook.com') ) ? $link = $link : $link = 'https://facebook.com' . $link;
1519
1520
- //Is it SSL?
1521
- $cff_ssl = '';
1522
- if (is_ssl()) $cff_ssl = '&return_ssl_resources=true';
1523
-
1524
- //Get the contents of the event
1525
- $event_json_url = 'https://graph.facebook.com/v2.8/'.$eventID.'?fields=cover,place,name,owner,start_time,timezone,id,comments.summary(true){message,created_time}&access_token=' . $access_token . $cff_ssl;
1526
-
1527
- //Don't use caching if the cache time is set to zero
1528
- if ($cff_cache_time != 0){
1529
- // Get any existing copy of our transient data
1530
- $transient_name = 'cff_tle_' . $eventID;
1531
- $transient_name = substr($transient_name, 0, 45);
1532
-
1533
- if ( false === ( $event_json = get_transient( $transient_name ) ) || $event_json === null ) {
1534
- //Get the contents of the Facebook page
1535
- $event_json = cff_fetchUrl($event_json_url);
1536
- //Cache the JSON for a week as the timeline event info probably isn't going to change
1537
- set_transient( $transient_name, $event_json, 60 * 60 * 24 * 7 );
1538
- } else {
1539
- $event_json = get_transient( $transient_name );
1540
- //If we can't find the transient then fall back to just getting the json from the api
1541
- if ($event_json == false) $event_json = cff_fetchUrl($event_json_url);
1542
- }
1543
- } else {
1544
- $event_json = cff_fetchUrl($event_json_url);
1545
- }
1546
-
1547
- //Interpret data with JSON
1548
- $event_object = json_decode($event_json);
1549
-
1550
- //Event date
1551
- isset($event_object->start_time)? $event_time = $event_object->start_time : $event_time = '';
1552
- isset($event_object->end_time) ? $event_end_time = ' - <span class="cff-end-date">' . cff_eventdate(strtotime($event_object->end_time), $cff_event_date_formatting, $cff_event_date_custom) . '</span>' : $event_end_time = '';
1553
- //If timezone migration is enabled then remove last 5 characters
1554
- if ( strlen($event_time) == 24 ) $event_time = substr($event_time, 0, -5);
1555
- $cff_event_date = '';
1556
- if (!empty($event_time)) $cff_event_date = '<span class="cff-date" '.$cff_event_date_styles.'><span class="cff-start-date">' . cff_eventdate(strtotime($event_time), $cff_event_date_formatting, $cff_event_date_custom) . '</span>' . $event_end_time.'</span>';
1557
-
1558
- //EVENT
1559
- //Display the event details
1560
- $cff_event .= '<span class="cff-details">';
1561
- //show event date above title
1562
- if ($cff_event_date_position == 'above') $cff_event .= $cff_event_date;
1563
- //Show event title
1564
- if ($cff_show_event_title && !empty($event_object->name)) {
1565
- $cff_event .= '<span class="cff-timeline-event-title" ' . $cff_event_title_styles . '>';
1566
- if ($cff_event_title_link) $cff_event .= '<a href="'.$link.'" '.$target.$cff_nofollow.'>';
1567
- $cff_event .= $event_object->name;
1568
- if ($cff_event_title_link) $cff_event .= '</a>';
1569
- $cff_event .= '</span>';
1570
- }
1571
- //show event date below title
1572
- if ($cff_event_date_position !== 'above') $cff_event .= $cff_event_date;
1573
- //Show event details
1574
- if ($cff_show_event_details){
1575
- //Location
1576
- if (!empty($event_object->place->name)) $cff_event .= '<span class="cff-where" ' . $cff_event_details_styles . '>' . $event_object->place->name . '</span>';
1577
- //Description
1578
- if (!empty($news->description)){
1579
- $description = cff_autolink($news->description, $link_color=$cff_event_link_color);
1580
-
1581
- $cff_description_tagged = cff_desc_tags($description);
1582
-
1583
- $cff_event .= '<span class="cff-info" ' . $cff_event_details_styles . '>' . $cff_description_tagged . '</span>';
1584
-
1585
- }
1586
- }
1587
- $cff_event .= '</span>';
1588
-
1589
- //Add event to post text so it can be included in the char count
1590
- if( !empty($post_text) && $post_text != '' ) $post_text .= $cff_linebreak_el.$cff_linebreak_el;
1591
- $post_text .= $cff_event;
1592
-
1593
- }
1594
-
1595
- }
1596
1597
//Create the HTML for the post text elemtent, if the post has text
1598
$cff_post_text = '';
3
Plugin Name: Custom Facebook Feed
4
Plugin URI: http://smashballoon.com/custom-facebook-feed
5
Description: Add completely customizable Facebook feeds to your WordPress site
6
+ Version: 2.5.2
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
24
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
*/
26
27
+ define('CFFVER', '2.5.2');
28
29
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
30
//Include admin
907
$cff_content .= '<div class="cff-error-msg"><p>Unable to display Facebook posts.<br/><a href="javascript:void(0);" id="cff-show-error" onclick="cffShowError()">Show error</a>';
908
$cff_content .= '<script type="text/javascript">function cffShowError() { document.getElementById("cff-error-reason").style.display = "block"; document.getElementById("cff-show-error").style.display = "none"; }</script>';
909
$cff_content .= '</p><div id="cff-error-reason">';
910
911
+ if( $cff_page_type == 'group' ){
912
+
913
+ $cff_content .= 'Due to recent changes in the Facebook API it is unfortunately no longer possible to display posts from Facebook Groups. Please see <a href="https://smashballoon.com/facebook-api-changes-april-4-2018/" target="_blank">this page</a> for more information.';
914
+
915
+ } else {
916
+
917
+ if( isset($FBdata->error->message) ) $cff_content .= 'Error: ' . $FBdata->error->message;
918
+ if( isset($FBdata->error->type) ) $cff_content .= '<br />Type: ' . $FBdata->error->type;
919
+ if( isset($FBdata->error->code) ) $cff_content .= '<br />Code: ' . $FBdata->error->code;
920
+ if( isset($FBdata->error->error_subcode) ) $cff_content .= '<br />Subcode: ' . $FBdata->error->error_subcode;
921
+
922
+ if( isset($FBdata->error_msg) ) $cff_content .= 'Error: ' . $FBdata->error_msg;
923
+ if( isset($FBdata->error_code) ) $cff_content .= '<br />Code: ' . $FBdata->error_code;
924
+
925
+ if($FBdata == null) $cff_content .= 'Error: Server configuration issue';
926
927
+ if( empty($FBdata->error) && empty($FBdata->error_msg) && $FBdata !== null ) $cff_content .= 'Error: No posts available for this Facebook ID';
928
929
+ $cff_content .= '<br />Please refer to our <a href="http://smashballoon.com/custom-facebook-feed/docs/errors/" target="_blank">Error Message Reference</a>.';
930
+
931
+ }
932
+
933
+
934
$cff_content .= '</div></div>'; //End .cff-error-msg and #cff-error-reason
935
//Only display errors to admins
936
if( current_user_can( 'manage_options' ) ){
1514
//EVENT
1515
$cff_event_has_cover_photo = false;
1516
$cff_event = '';
1517
1518
1519
//Create the HTML for the post text elemtent, if the post has text
1520
$cff_post_text = '';
js/cff-admin-scripts.js CHANGED
@@ -15,28 +15,35 @@ jQuery(document).ready(function($) {
15
//Is this a page, group or profile?
16
var cff_page_type = jQuery('.cff-page-type select').val(),
17
$cff_page_type_options = jQuery('.cff-page-options'),
18
- $cff_profile_error = jQuery('.cff-profile-error.cff-page-type');
19
20
//Should we show anything initially?
21
if(cff_page_type !== 'page') $cff_page_type_options.hide();
22
if(cff_page_type == 'profile') $cff_profile_error.show();
23
24
//When page type is changed show the relevant item
25
jQuery('.cff-page-type').change(function(){
26
cff_page_type = jQuery('.cff-page-type select').val();
27
28
if( cff_page_type !== 'page' ) {
29
- $cff_page_type_options.fadeOut(function(){
30
- if( cff_page_type == 'profile' ) {
31
- $cff_profile_error.fadeIn();
32
} else {
33
- $cff_profile_error.fadeOut();
34
}
35
- });
36
37
} else {
38
- $cff_page_type_options.fadeIn();
39
- $cff_profile_error.fadeOut();
40
}
41
});
42
15
//Is this a page, group or profile?
16
var cff_page_type = jQuery('.cff-page-type select').val(),
17
$cff_page_type_options = jQuery('.cff-page-options'),
18
+ $cff_profile_error = jQuery('.cff-profile-error.cff-page-type'),
19
+ $cff_group_error = jQuery('.cff-group-error.cff-page-type');
20
21
//Should we show anything initially?
22
if(cff_page_type !== 'page') $cff_page_type_options.hide();
23
if(cff_page_type == 'profile') $cff_profile_error.show();
24
+ if(cff_page_type == 'group') $cff_group_error.show();
25
26
//When page type is changed show the relevant item
27
jQuery('.cff-page-type').change(function(){
28
cff_page_type = jQuery('.cff-page-type select').val();
29
30
if( cff_page_type !== 'page' ) {
31
+ $cff_page_type_options.hide();
32
+ if( cff_page_type == 'profile' ) {
33
+ $cff_profile_error.show();
34
+ $cff_group_error.hide();
35
+ } else if( cff_page_type == 'group' ) {
36
+ $cff_group_error.show();
37
+ $cff_profile_error.hide();
38
} else {
39
+ $cff_group_error.hide();
40
+ $cff_profile_error.hide();
41
}
42
43
} else {
44
+ $cff_page_type_options.show();
45
+ $cff_profile_error.hide();
46
+ $cff_group_error.hide();
47
}
48
});
49