Instagram Feed - Version 2.2.1

Version Description

  • Important: March 2 deadline for migrating to the new Instagram API pushed back to March 31 by Instagram.
  • Fix: Some links to Instagram were missing a backslash at the end of the URL causing a 301 redirect.
  • Fix: Error saving updated account information caused by emoji in account bio or in account names and MySQL tables that didn't have a UTF8mb4 character set.
Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Instagram Feed
Version 2.2.1
Comparing to
See all releases

Code changes from version 2.2 to 2.2.1

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon, craig-at-smash-balloon
3
Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
4
Requires at least: 3.4
5
Tested up to: 5.3
6
- Stable tag: 2.2
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
@@ -324,8 +324,13 @@ We understand that sometimes you need help, have issues or just have questions.
324
* Plus more customization options added all the time!
325
326
== Changelog ==
327
= 2.2 =
328
- * Important: On March 2, Instagram will stop supporting its old API which will disrupt feeds created from personal connected accounts. If you are using a personal account, you will need to reconnect the account on the Instagram Feed Settings page. Please [see here](https://smashballoon.com/instagram-api-changes-march-2-2020/) for more information.
329
* New: Support added for the new Instagram Basic Display API.
330
* New: Added PHP hooks 'sbi_before_feed' and 'sbi_after_feed' for displaying HTML before and after the main Instagram feed HTML.
331
* New: Added settings for adding a custom header avatar and custom header bio text. Go to the "Customize" tab "Header" area to set these or use customavatar="AVATAR URL" or custombio="BIO TEXT" in the shortcode.
3
Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
4
Requires at least: 3.4
5
Tested up to: 5.3
6
+ Stable tag: 2.2.1
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
324
* Plus more customization options added all the time!
325
326
== Changelog ==
327
+ = 2.2.1 =
328
+ * Important: March 2 deadline for migrating to the new Instagram API pushed back to March 31 by Instagram.
329
+ * Fix: Some links to Instagram were missing a backslash at the end of the URL causing a 301 redirect.
330
+ * Fix: Error saving updated account information caused by emoji in account bio or in account names and MySQL tables that didn't have a UTF8mb4 character set.
331
+
332
= 2.2 =
333
+ * Important: On March 31, Instagram will stop supporting its old API which will disrupt feeds created from personal connected accounts. If you are using a personal account, you will need to reconnect the account on the Instagram Feed Settings page. Please [see here](https://smashballoon.com/instagram-api-changes-march-2-2020/) for more information.
334
* New: Support added for the new Instagram Basic Display API.
335
* New: Added PHP hooks 'sbi_before_feed' and 'sbi_after_feed' for displaying HTML before and after the main Instagram feed HTML.
336
* New: Added settings for adding a custom header avatar and custom header bio text. Go to the "Customize" tab "Header" area to set these or use customavatar="AVATAR URL" or custombio="BIO TEXT" in the shortcode.
inc/admin/actions.php CHANGED
@@ -180,7 +180,7 @@ function sbi_connect_business_accounts() {
180
'is_valid' => true,
181
'last_checked' => time(),
182
'profile_picture' => $profile_picture,
183
- 'name' => $name,
184
'type' => $type,
185
'use_tagged' => '1'
186
);
@@ -585,7 +585,7 @@ function sbi_connect_basic_account( $new_account_details ) {
585
if ( ! empty( $fuzzy_matches[0] ) ) {
586
$header_data = sbi_find_matching_data_from_results( $fuzzy_matches, $old_account_user_id );
587
$bio = SB_Instagram_Parse::get_bio( $header_data );
588
- $accounts_to_save[ $new_account_details['user_id'] ]['bio'] = $bio;
589
}
590
591
}
@@ -877,7 +877,7 @@ function sbi_reconnect_accounts_notice() {
877
$error = '<p><b>' . sprintf( __( 'Error: Instagram Feed plugin - account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to recent Instagram platform changes some Instagram accounts will need to be reconnected in the plugin in order for them to continue updating.', 'instagram-feed' );
878
} else {
879
$notice_class = 'notice-warning';
880
- $error = '<p><b>' . sprintf( __( 'Warning: Instagram Feed plugin - account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to Instagram platform changes on March 2, 2020, some Instagram accounts will need to be reconnected in the plugin to avoid disruption to your feeds.', 'instagram-feed' );
881
}
882
if( !$should_show_link ) $error .= __( ' Use the big blue button below to reconnect your account.', 'instagram-feed' );
883
}
180
'is_valid' => true,
181
'last_checked' => time(),
182
'profile_picture' => $profile_picture,
183
+ 'name' => sbi_sanitize_emoji( $name ),
184
'type' => $type,
185
'use_tagged' => '1'
186
);
585
if ( ! empty( $fuzzy_matches[0] ) ) {
586
$header_data = sbi_find_matching_data_from_results( $fuzzy_matches, $old_account_user_id );
587
$bio = SB_Instagram_Parse::get_bio( $header_data );
588
+ $accounts_to_save[ $new_account_details['user_id'] ]['bio'] = sbi_sanitize_emoji( $bio );
589
}
590
591
}
877
$error = '<p><b>' . sprintf( __( 'Error: Instagram Feed plugin - account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to recent Instagram platform changes some Instagram accounts will need to be reconnected in the plugin in order for them to continue updating.', 'instagram-feed' );
878
} else {
879
$notice_class = 'notice-warning';
880
+ $error = '<p><b>' . sprintf( __( 'Warning: Instagram Feed plugin - account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to Instagram platform changes on March 31, 2020, some Instagram accounts will need to be reconnected in the plugin to avoid disruption to your feeds.', 'instagram-feed' );
881
}
882
if( !$should_show_link ) $error .= __( ' Use the big blue button below to reconnect your account.', 'instagram-feed' );
883
}
inc/admin/main.php CHANGED
@@ -664,7 +664,7 @@ function sb_instagram_settings_page() {
664
if ( sbi_is_after_deprecation_deadline() ) {
665
$deprecated_connected_account_message = __( '<b>Action Needed:</b> Reconnect this account to allow feed to update.', 'instagram-feed' );
666
} else {
667
- $deprecated_connected_account_message = __( '<b>Action Needed:</b> Reconnect this account before March 2, 2020 to avoid disruption with this feed.', 'instagram-feed' );
668
}
669
670
$accounts_that_need_updating = sbi_get_user_names_of_personal_accounts_not_also_already_updated();
@@ -1438,7 +1438,7 @@ function sb_instagram_settings_page() {
1438
1439
<textarea type="text" name="sb_instagram_custom_bio" id="sb_instagram_custom_bio" ><?php echo esc_textarea( stripslashes( $sb_instagram_custom_bio ) ); ?></textarea>
1440
&nbsp;<a class="sbi_tooltip_link sbi_tooltip_under" href="JavaScript:void(0);"><?php _e("Why is my bio not displaying automatically?", 'instagram-feed'); ?></a>
1441
- <p class="sbi_tooltip" style="padding: 10px 0 0 0; width: 99%;"><?php echo sprintf( __("Instagram is deprecating their old API for Personal accounts on March 2, 2020. The plugin supports their new API, however, their new API does not yet include the bio text for Personal accounts. If you require this feature then it is available if you convert your Instagram account from a Personal to a Business account by following %s. Note: If you previously had a Personal account connected then the plugin has saved the avatar for that feed and will continue to use it automatically.", 'instagram-feed'), '<a href="https://smashballoon.com/instagram-business-profiles/" target="_blank">these directions</a>' ); ?></p>
1442
</div>
1443
</div>
1444
@@ -1454,7 +1454,7 @@ function sb_instagram_settings_page() {
1454
<br>
1455
<a class="sbi_tooltip_link sbi_tooltip_under" href="JavaScript:void(0);"><?php _e("Why is my avatar not displaying automatically?", 'instagram-feed'); ?></a>
1456
1457
- <p class="sbi_tooltip sbi_tooltip_under_text" style="padding: 10px 0 0 0;"><?php echo sprintf( __("Instagram is deprecating their old API for Personal accounts on March 2, 2020. The plugin supports their new API, however, their new API does not yet include the avatar image for Personal accounts. If you require this feature then it is available if you convert your Instagram account from a Personal to a Business account by following %s. Note: If you previously had a Personal account connected then the plugin has saved the bio text for that feed and will continue to use it automatically.", 'instagram-feed'), '<a href="https://smashballoon.com/instagram-business-profiles/" target="_blank">these directions</a>' ); ?></p>
1458
1459
</td>
1460
</tr>
664
if ( sbi_is_after_deprecation_deadline() ) {
665
$deprecated_connected_account_message = __( '<b>Action Needed:</b> Reconnect this account to allow feed to update.', 'instagram-feed' );
666
} else {
667
+ $deprecated_connected_account_message = __( '<b>Action Needed:</b> Reconnect this account before March 31, 2020 to avoid disruption with this feed.', 'instagram-feed' );
668
}
669
670
$accounts_that_need_updating = sbi_get_user_names_of_personal_accounts_not_also_already_updated();
1438
1439
<textarea type="text" name="sb_instagram_custom_bio" id="sb_instagram_custom_bio" ><?php echo esc_textarea( stripslashes( $sb_instagram_custom_bio ) ); ?></textarea>
1440
&nbsp;<a class="sbi_tooltip_link sbi_tooltip_under" href="JavaScript:void(0);"><?php _e("Why is my bio not displaying automatically?", 'instagram-feed'); ?></a>
1441
+ <p class="sbi_tooltip" style="padding: 10px 0 0 0; width: 99%;"><?php echo sprintf( __("Instagram is deprecating their old API for Personal accounts on March 31, 2020. The plugin supports their new API, however, their new API does not yet include the bio text for Personal accounts. If you require this feature then it is available if you convert your Instagram account from a Personal to a Business account by following %s. Note: If you previously had a Personal account connected then the plugin has saved the avatar for that feed and will continue to use it automatically.", 'instagram-feed'), '<a href="https://smashballoon.com/instagram-business-profiles/" target="_blank">these directions</a>' ); ?></p>
1442
</div>
1443
</div>
1444
1454
<br>
1455
<a class="sbi_tooltip_link sbi_tooltip_under" href="JavaScript:void(0);"><?php _e("Why is my avatar not displaying automatically?", 'instagram-feed'); ?></a>
1456
1457
+ <p class="sbi_tooltip sbi_tooltip_under_text" style="padding: 10px 0 0 0;"><?php echo sprintf( __("Instagram is deprecating their old API for Personal accounts on March 31, 2020. The plugin supports their new API, however, their new API does not yet include the avatar image for Personal accounts. If you require this feature then it is available if you convert your Instagram account from a Personal to a Business account by following %s. Note: If you previously had a Personal account connected then the plugin has saved the bio text for that feed and will continue to use it automatically.", 'instagram-feed'), '<a href="https://smashballoon.com/instagram-business-profiles/" target="_blank">these directions</a>' ); ?></p>
1458
1459
</td>
1460
</tr>
inc/class-sb-instagram-feed.php CHANGED
@@ -788,7 +788,7 @@ class SB_Instagram_Feed
788
if ( empty( $this->header_data['bio'] )
789
&& isset( $connected_accounts_for_feed[ $first_user ]['bio'] ) ) {
790
791
- $this->header_data['bio'] = $connected_accounts_for_feed[ $first_user ]['bio'];
792
}
793
} else {
794
if ( $connection->is_wp_error() ) {
788
if ( empty( $this->header_data['bio'] )
789
&& isset( $connected_accounts_for_feed[ $first_user ]['bio'] ) ) {
790
791
+ $this->header_data['bio'] = sbi_decode_emoji( $connected_accounts_for_feed[ $first_user ]['bio'] );
792
}
793
} else {
794
if ( $connection->is_wp_error() ) {
inc/class-sb-instagram-settings.php CHANGED
@@ -355,7 +355,7 @@ class SB_Instagram_Settings {
355
}
356
357
if ( ! $is_after_deprecation_deadline && $is_using_access_token_in_shortcode ) {
358
- $error = '<p><b>' . __( 'Warning: Cannot add access token directly to the shortcode.', 'instagram-feed' ) . '</b><br>' . sprintf( __( 'Due to upcoming Instagram platform changes on March 2, 2020, it will no longer be possible for feeds to use access tokens directly in the shortcode. Remove the access token from the shortcode and connect an account on the %s instead.', 'instagram-feed' ), $settings_link );
359
360
$sb_instagram_posts_manager->add_frontend_error( 'deprecation_warning', $error );
361
$access_tokens = explode( ',', str_replace( ' ', '', $this->atts['accesstoken'] ) );
@@ -564,7 +564,7 @@ class SB_Instagram_Settings {
564
if ( $is_after_deprecation_deadline ) {
565
$error = '<p><b>' . sprintf( __( 'Error: The account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to recent Instagram platform changes this Instagram account needs to be reconnected in order to continue updating.', 'instagram-feed' ) . '<a href="'.get_admin_url().'?page=sb-instagram-feed" class="sb_frontend_btn"><i class="fa fa-cog" aria-hidden="true"></i> ' . __( 'Reconnect on plugin Settings page', 'instagram-feed' ) . '</a>';
566
} else {
567
- $error = '<p><b>' . sprintf( __( 'Warning: The account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to Instagram platform changes on March 2, 2020, this Instagram account needs to be reconnected to allow the feed to continue updating.', 'instagram-feed' ) . '<a href="'.get_admin_url().'?page=sb-instagram-feed" class="sb_frontend_btn"><i class="fa fa-cog" aria-hidden="true"></i> ' . __( 'Reconnect on plugin Settings page', 'instagram-feed' ) . '</a>';
568
}
569
570
$sb_instagram_posts_manager->add_frontend_error( 'deprecation_warning', $error );
355
}
356
357
if ( ! $is_after_deprecation_deadline && $is_using_access_token_in_shortcode ) {
358
+ $error = '<p><b>' . __( 'Warning: Cannot add access token directly to the shortcode.', 'instagram-feed' ) . '</b><br>' . sprintf( __( 'Due to upcoming Instagram platform changes on March 31, 2020, it will no longer be possible for feeds to use access tokens directly in the shortcode. Remove the access token from the shortcode and connect an account on the %s instead.', 'instagram-feed' ), $settings_link );
359
360
$sb_instagram_posts_manager->add_frontend_error( 'deprecation_warning', $error );
361
$access_tokens = explode( ',', str_replace( ' ', '', $this->atts['accesstoken'] ) );
564
if ( $is_after_deprecation_deadline ) {
565
$error = '<p><b>' . sprintf( __( 'Error: The account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to recent Instagram platform changes this Instagram account needs to be reconnected in order to continue updating.', 'instagram-feed' ) . '<a href="'.get_admin_url().'?page=sb-instagram-feed" class="sb_frontend_btn"><i class="fa fa-cog" aria-hidden="true"></i> ' . __( 'Reconnect on plugin Settings page', 'instagram-feed' ) . '</a>';
566
} else {
567
+ $error = '<p><b>' . sprintf( __( 'Warning: The account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to Instagram platform changes on March 31, 2020, this Instagram account needs to be reconnected to allow the feed to continue updating.', 'instagram-feed' ) . '<a href="'.get_admin_url().'?page=sb-instagram-feed" class="sb_frontend_btn"><i class="fa fa-cog" aria-hidden="true"></i> ' . __( 'Reconnect on plugin Settings page', 'instagram-feed' ) . '</a>';
568
}
569
570
$sb_instagram_posts_manager->add_frontend_error( 'deprecation_warning', $error );
inc/if-functions.php CHANGED
@@ -766,6 +766,32 @@ function sbi_hextorgb( $hex ) {
766
return implode( ',', $rgb ); // returns the rgb values separated by commas
767
}
768
769
/**
770
* @return int
771
*/
766
return implode( ',', $rgb ); // returns the rgb values separated by commas
767
}
768
769
+
770
+ /**
771
+ * Added to workaround MySQL tables that don't use utf8mb4 character sets
772
+ *
773
+ * @since 2.2.1/5.3.1
774
+ */
775
+ function sbi_sanitize_emoji( $string ) {
776
+ $encoded = array(
777
+ 'jsonencoded' => $string
778
+ );
779
+ return wp_json_encode( $encoded );
780
+ }
781
+
782
+ /**
783
+ * Added to workaround MySQL tables that don't use utf8mb4 character sets
784
+ *
785
+ * @since 2.2.1/5.3.1
786
+ */
787
+ function sbi_decode_emoji( $string ) {
788
+ if ( strpos( $string, '{"' ) !== false ) {
789
+ $decoded = json_decode( $string, true );
790
+ return $decoded['jsonencoded'];
791
+ }
792
+ return $string;
793
+ }
794
+
795
/**
796
* @return int
797
*/
instagram-feed.php CHANGED
@@ -3,13 +3,13 @@
3
Plugin Name: Smash Balloon Instagram Feed
4
Plugin URI: https://smashballoon.com/instagram-feed
5
Description: Display beautifully clean, customizable, and responsive Instagram feeds.
6
- Version: 2.2
7
Author: Smash Balloon
8
Author URI: https://smashballoon.com/
9
License: GPLv2 or later
10
Text Domain: instagram-feed
11
12
- Copyright 2019 Smash Balloon LLC (email : hey@smashballoon.com)
13
This program is free software; you can redistribute it and/or modify
14
it under the terms of the GNU General Public License as published by
15
the Free Software Foundation; either version 2 of the License, or
@@ -23,7 +23,7 @@ along with this program; if not, write to the Free Software
23
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
*/
25
if ( ! defined( 'SBIVER' ) ) {
26
- define( 'SBIVER', '2.2' );
27
}
28
// Db version.
29
if ( ! defined( 'SBI_DBVERSION' ) ) {
3
Plugin Name: Smash Balloon Instagram Feed
4
Plugin URI: https://smashballoon.com/instagram-feed
5
Description: Display beautifully clean, customizable, and responsive Instagram feeds.
6
+ Version: 2.2.1
7
Author: Smash Balloon
8
Author URI: https://smashballoon.com/
9
License: GPLv2 or later
10
Text Domain: instagram-feed
11
12
+ Copyright 2020 Smash Balloon LLC (email : hey@smashballoon.com)
13
This program is free software; you can redistribute it and/or modify
14
it under the terms of the GNU General Public License as published by
15
the Free Software Foundation; either version 2 of the License, or
23
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
*/
25
if ( ! defined( 'SBIVER' ) ) {
26
+ define( 'SBIVER', '2.2.1' );
27
}
28
// Db version.
29
if ( ! defined( 'SBI_DBVERSION' ) ) {
js/sb-instagram-admin-2-2.js CHANGED
@@ -5,11 +5,11 @@ jQuery(document).ready(function($) {
5
event.preventDefault();
6
7
var today = new Date(),
8
- march = new Date('March 3, 2020 00:00:00'),
9
oldApiURL = $(this).attr('data-old-api'),
10
oldApiLink = '';
11
if (today.getTime() < march.getTime()) {
12
- oldApiLink = 'To connect using the legacy API, <a href="'+oldApiURL+'">click here</a> (expires on March 2, 2020).';
13
}
14
15
var personalBasicApiURL = $('#sbi_config .sbi_admin_btn').attr('data-personal-basic-api'),
5
event.preventDefault();
6
7
var today = new Date(),
8
+ march = new Date('March 31, 2020 00:00:00'),
9
oldApiURL = $(this).attr('data-old-api'),
10
oldApiLink = '';
11
if (today.getTime() < march.getTime()) {
12
+ oldApiLink = 'To connect using the legacy API, <a href="'+oldApiURL+'">click here</a> (expires on March 31, 2020).';
13
}
14
15
var personalBasicApiURL = $('#sbi_config .sbi_admin_btn').attr('data-personal-basic-api'),
templates/footer.php CHANGED
@@ -32,7 +32,7 @@ $load_button_text = __( $settings['buttontext'], 'instagram-feed' );
32
33
<?php if ( $first_username && $show_follow_button ) : ?>
34
<span class="sbi_follow_btn<?php echo esc_attr( $follow_btn_classes ); ?>">
35
- <a href="<?php echo esc_url( 'https://www.instagram.com/' . $first_username ); ?>" <?php echo $follow_btn_style; ?> target="_blank" rel="noopener"><?php echo SB_Instagram_Display_Elements::get_icon( 'instagram', $icon_type );echo esc_html( $follow_button_text ); ?></a>
36
</span>
37
<?php endif; ?>
38
32
33
<?php if ( $first_username && $show_follow_button ) : ?>
34
<span class="sbi_follow_btn<?php echo esc_attr( $follow_btn_classes ); ?>">
35
+ <a href="<?php echo esc_url( 'https://www.instagram.com/' . $first_username . '/' ); ?>" <?php echo $follow_btn_style; ?> target="_blank" rel="noopener"><?php echo SB_Instagram_Display_Elements::get_icon( 'instagram', $icon_type );echo esc_html( $follow_button_text ); ?></a>
36
</span>
37
<?php endif; ?>
38
templates/header.php CHANGED
@@ -26,7 +26,7 @@ $bio_class = ! $should_show_bio ? ' sbi_no_bio' : '';
26
$avatar_class = $avatar !== '' ? '' : ' sbi_no_avatar';
27
?>
28
<div class="sb_instagram_header <?php echo esc_attr( $size_class ) . esc_attr( $avatar_class ); ?>" style="<?php echo $header_padding . $header_margin; ?>padding-bottom: 0;">
29
- <a href="https://www.instagram.com/<?php echo urlencode( $username ); ?>" target="_blank" rel="noopener" title="@<?php echo esc_attr( $username ); ?>" class="sbi_header_link">
30
<div class="sbi_header_text<?php echo esc_attr( $bio_class ); ?>">
31
<h3 <?php echo $header_text_color_style; ?>><?php echo esc_html( $username ); ?></h3>
32
<?php if ( $should_show_bio ) : ?>
26
$avatar_class = $avatar !== '' ? '' : ' sbi_no_avatar';
27
?>
28
<div class="sb_instagram_header <?php echo esc_attr( $size_class ) . esc_attr( $avatar_class ); ?>" style="<?php echo $header_padding . $header_margin; ?>padding-bottom: 0;">
29
+ <a href="https://www.instagram.com/<?php echo urlencode( $username ) ; ?>/" target="_blank" rel="noopener" title="@<?php echo esc_attr( $username ); ?>" class="sbi_header_link">
30
<div class="sbi_header_text<?php echo esc_attr( $bio_class ); ?>">
31
<h3 <?php echo $header_text_color_style; ?>><?php echo esc_html( $username ); ?></h3>
32
<?php if ( $should_show_bio ) : ?>