Version Description
- Fix: Unable to connect new accounts due to changes with Instagram's API. Remote requests to connect accounts are now made server-side.
Download this release
Release Info
Developer | smashballoon |
Plugin | Instagram Feed |
Version | 1.11.2 |
Comparing to | |
See all releases |
Code changes from version 1.11.1 to 1.11.2
- README.txt +4 -1
- instagram-feed-admin.php +12 -0
- instagram-feed.php +2 -2
- js/sb-instagram-admin.js +65 -38
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.0
|
5 |
Tested up to: 5.1
|
6 |
-
Stable tag: 1.11.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -324,6 +324,9 @@ 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 |
= 1.11.1 =
|
328 |
* Fix: Feed would not load from a cache created with an older version of the plugin
|
329 |
* Fix: Fixed PHP warning trying to count string length of an array
|
3 |
Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.1
|
6 |
+
Stable tag: 1.11.2
|
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 |
+
= 1.11.2 =
|
328 |
+
* Fix: Unable to connect new accounts due to changes with Instagram's API. Remote requests to connect accounts are now made server-side.
|
329 |
+
|
330 |
= 1.11.1 =
|
331 |
* Fix: Feed would not load from a cache created with an older version of the plugin
|
332 |
* Fix: Fixed PHP warning trying to count string length of an array
|
instagram-feed-admin.php
CHANGED
@@ -2442,6 +2442,18 @@ function sbi_get_connected_accounts_data( $sb_instagram_at ) {
|
|
2442 |
return $return;
|
2443 |
}
|
2444 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2445 |
// variables to define certain terms
|
2446 |
$transient = 'instagram_feed_rating_notice_waiting';
|
2447 |
$option = 'sbi_rating_notice';
|
2442 |
return $return;
|
2443 |
}
|
2444 |
|
2445 |
+
function sbi_after_connection() {
|
2446 |
+
|
2447 |
+
if ( isset( $_POST['access_token'] ) ) {
|
2448 |
+
$access_token = sanitize_text_field( $_POST['access_token'] );
|
2449 |
+
$account_info = sbi_account_data_for_token( $access_token );
|
2450 |
+
echo json_encode( $account_info );
|
2451 |
+
}
|
2452 |
+
|
2453 |
+
die();
|
2454 |
+
}
|
2455 |
+
add_action( 'wp_ajax_sbi_after_connection', 'sbi_after_connection' );
|
2456 |
+
|
2457 |
// variables to define certain terms
|
2458 |
$transient = 'instagram_feed_rating_notice_waiting';
|
2459 |
$option = 'sbi_rating_notice';
|
instagram-feed.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Instagram Feed
|
4 |
Plugin URI: https://smashballoon.com/instagram-feed
|
5 |
Description: Display beautifully clean, customizable, and responsive Instagram feeds
|
6 |
-
Version: 1.11.
|
7 |
Author: Smash Balloon
|
8 |
Author URI: https://smashballoon.com/
|
9 |
License: GPLv2 or later
|
@@ -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 |
|
26 |
-
define( 'SBIVER', '1.11.
|
27 |
|
28 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
|
3 |
Plugin Name: Instagram Feed
|
4 |
Plugin URI: https://smashballoon.com/instagram-feed
|
5 |
Description: Display beautifully clean, customizable, and responsive Instagram feeds
|
6 |
+
Version: 1.11.2
|
7 |
Author: Smash Balloon
|
8 |
Author URI: https://smashballoon.com/
|
9 |
License: GPLv2 or later
|
23 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
24 |
*/
|
25 |
|
26 |
+
define( 'SBIVER', '1.11.2' );
|
27 |
|
28 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
|
js/sb-instagram-admin.js
CHANGED
@@ -5,61 +5,88 @@ jQuery(document).ready(function($) {
|
|
5 |
id = token.split('.')[0];
|
6 |
|
7 |
if (token.length > 40) {
|
|
|
8 |
//https://api.instagram.com/v1/users/self/?access_token=' . sbi_maybe_clean( $access_token )
|
9 |
$('.sbi_admin_btn').css('opacity','.5').after('<div class="spinner" style="visibility: visible; position: relative;float: left;margin-top: 15px;"></div>');
|
10 |
var url = 'https://api.instagram.com/v1/users/self/?access_token=' + token;
|
11 |
jQuery.ajax({
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
$('#sbi_config').append('<div id="sbi_config_info" class="sb_get_token">' +
|
27 |
'<div class="sbi_config_modal">' +
|
28 |
-
'<
|
29 |
-
'<
|
30 |
-
'<p class="sbi_submit"><input type="submit" name="sbi_submit" id="sbi_connect_account" class="button button-primary" value="'+buttonText+'">' +
|
31 |
-
'<a href="JavaScript:void(0);" class="button button-secondary" id="sbi_switch_accounts">Switch Accounts</a></p>' +
|
32 |
'<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>' +
|
33 |
'</div>' +
|
34 |
'</div>');
|
35 |
|
36 |
-
$('#sbi_connect_account').click(function(event) {
|
37 |
-
event.preventDefault();
|
38 |
-
$('#sbi_config_info').fadeOut(200);
|
39 |
-
sbSaveToken(token,false);
|
40 |
-
});
|
41 |
-
|
42 |
sbiSwitchAccounts();
|
43 |
}
|
44 |
|
45 |
-
},
|
46 |
-
error: function(data) {
|
47 |
-
$('.sbi_admin_btn').css('opacity','1');
|
48 |
-
$('#sbi_config').find('.spinner').remove();
|
49 |
-
var message = typeof data.responseJSON !== 'undefined' && data.responseJSON.error_type === 'OAuthRateLimitException' ? 'This account\'s access token is currently over the rate limit. Try removing this access token from all feeds and wait an hour before reconnecting.' : 'There was an error connecting your account';
|
50 |
-
|
51 |
-
$('#sbi_config').append('<div id="sbi_config_info" class="sb_get_token">' +
|
52 |
-
'<div class="sbi_config_modal">' +
|
53 |
-
'<p>'+message+'</p>' +
|
54 |
-
'<p class="sbi_submit"><a href="JavaScript:void(0);" class="button button-secondary" id="sbi_switch_accounts">Switch Accounts</a></p>' +
|
55 |
-
'<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>' +
|
56 |
-
'</div>' +
|
57 |
-
'</div>');
|
58 |
-
|
59 |
-
sbiSwitchAccounts();
|
60 |
}
|
61 |
});
|
62 |
|
|
|
63 |
function sbiSwitchAccounts(){
|
64 |
$('#sbi_switch_accounts').on('click', function(){
|
65 |
//Log user out of Instagram by hitting the logout URL in an iframe
|
5 |
id = token.split('.')[0];
|
6 |
|
7 |
if (token.length > 40) {
|
8 |
+
|
9 |
//https://api.instagram.com/v1/users/self/?access_token=' . sbi_maybe_clean( $access_token )
|
10 |
$('.sbi_admin_btn').css('opacity','.5').after('<div class="spinner" style="visibility: visible; position: relative;float: left;margin-top: 15px;"></div>');
|
11 |
var url = 'https://api.instagram.com/v1/users/self/?access_token=' + token;
|
12 |
jQuery.ajax({
|
13 |
+
url: sbiA.ajax_url,
|
14 |
+
type: 'post',
|
15 |
+
data: {
|
16 |
+
action: 'sbi_after_connection',
|
17 |
+
access_token: token,
|
18 |
+
},
|
19 |
+
success: function (data) {
|
20 |
+
if (data.indexOf('{') === 0) {
|
21 |
+
var accountInfo = JSON.parse(data);
|
22 |
+
if (typeof accountInfo.error_message === 'undefined') {
|
23 |
+
accountInfo.token = token;
|
24 |
+
|
25 |
+
$('.sbi_admin_btn').css('opacity','1');
|
26 |
+
$('#sbi_config').find('.spinner').remove();
|
27 |
+
if (!$('.sbi_connected_account ').length) {
|
28 |
+
$('.sbi_no_accounts').remove();
|
29 |
+
sbSaveToken(token,true);
|
30 |
+
} else {
|
31 |
+
var buttonText = 'Connect This Account';
|
32 |
+
// if the account is connected, offer to update in case information has changed.
|
33 |
+
if ($('#sbi_connected_account_'+id).length) {
|
34 |
+
buttonText = 'Update This Account';
|
35 |
+
}
|
36 |
+
$('#sbi_config').append('<div id="sbi_config_info" class="sb_get_token">' +
|
37 |
+
'<div class="sbi_config_modal">' +
|
38 |
+
'<img class="sbi_ca_avatar" src="'+accountInfo.profile_picture+'" />' +
|
39 |
+
'<div class="sbi_ca_username"><strong>'+accountInfo.username+'</strong></div>' +
|
40 |
+
'<p class="sbi_submit"><input type="submit" name="sbi_submit" id="sbi_connect_account" class="button button-primary" value="'+buttonText+'">' +
|
41 |
+
'<a href="JavaScript:void(0);" class="button button-secondary" id="sbi_switch_accounts">Switch Accounts</a></p>' +
|
42 |
+
'<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>' +
|
43 |
+
'</div>' +
|
44 |
+
'</div>');
|
45 |
+
|
46 |
+
$('#sbi_connect_account').click(function(event) {
|
47 |
+
event.preventDefault();
|
48 |
+
$('#sbi_config_info').fadeOut(200);
|
49 |
+
sbSaveToken(token,false);
|
50 |
+
});
|
51 |
+
|
52 |
+
sbiSwitchAccounts();
|
53 |
+
}
|
54 |
+
} else {
|
55 |
+
$('.sbi_admin_btn').css('opacity','1');
|
56 |
+
$('#sbi_config').find('.spinner').remove();
|
57 |
+
var message = accountInfo.error_message;
|
58 |
+
|
59 |
+
$('#sbi_config').append('<div id="sbi_config_info" class="sb_get_token">' +
|
60 |
+
'<div class="sbi_config_modal">' +
|
61 |
+
'<p>'+message+'</p>' +
|
62 |
+
'<p class="sbi_submit"><a href="JavaScript:void(0);" class="button button-secondary" id="sbi_switch_accounts">Switch Accounts</a></p>' +
|
63 |
+
'<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>' +
|
64 |
+
'</div>' +
|
65 |
+
'</div>');
|
66 |
+
|
67 |
+
sbiSwitchAccounts();
|
68 |
}
|
69 |
+
|
70 |
+
} else {
|
71 |
+
$('.sbi_admin_btn').css('opacity','1');
|
72 |
+
$('#sbi_config').find('.spinner').remove();
|
73 |
+
var message = 'There was an error connecting your account';
|
74 |
+
|
75 |
$('#sbi_config').append('<div id="sbi_config_info" class="sb_get_token">' +
|
76 |
'<div class="sbi_config_modal">' +
|
77 |
+
'<p>'+message+'</p>' +
|
78 |
+
'<p class="sbi_submit"><a href="JavaScript:void(0);" class="button button-secondary" id="sbi_switch_accounts">Switch Accounts</a></p>' +
|
|
|
|
|
79 |
'<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>' +
|
80 |
'</div>' +
|
81 |
'</div>');
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
sbiSwitchAccounts();
|
84 |
}
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
});
|
88 |
|
89 |
+
|
90 |
function sbiSwitchAccounts(){
|
91 |
$('#sbi_switch_accounts').on('click', function(){
|
92 |
//Log user out of Instagram by hitting the logout URL in an iframe
|