Processing
 

Combined social media feed returning the wrong data

26/08/2016 15:13#1

Joined at: 5 months ago

Post: 1

Thank: 0

Thanked: 0

I've created a social media plugin the display facebook and twitter feeds in the same div on my website. It is working, but the tweets are showing up as facebook items and facebook items are linked to the wrong account.

It uses twiiter and facebook IDs and I have used the correct ones, so i can't work out why this is happening.

JS on page

$(document).ready(function() { var feedData = new $.GetSocialFeed($('#socialFeed').find('.sf_content'), {           twitter: true,     facebook: true,          twitterID: '121402638',         facebookID: '351687753504',     renderHtml: true,           onCallback: function(data) {      } }); }); 

JS

(function($) {    $.GetSocialFeed = function(el, options) {      var defaults = {       'url': 'https://kentunionapps.co.uk/di43/helperScripts/GetSocialFeed.php',       'twitter': false,       'twitterID': false,       'twitterHashtag': false,       'facebook': false,       'facebookID': false,       'items_total': 10,       'renderHtml': false,       onCallback: function() {}     };      var plugin = this;      plugin.settings = {};      var init = function() {       plugin.settings = $.extend({}, defaults, options);       plugin.el = el;        httpRequest().then(function(data) {         if( !plugin.settings.renderHtml )           plugin.settings.onCallback.call(plugin.el, data);         else {           plugin.settings.onCallback.call(plugin.el, data);           plugin.el.html(renderHtml(data));           plugin.el.mCustomScrollbar({             theme: 'minimal-dark',             scrollInertia: 0           });         }       }, function(msg) {         plugin.settings.onCallback.call(plugin.el, msg);       });     };      var httpRequest = function() {       var deferred = $.Deferred();        if( plugin.settings.twitter || plugin.settings.facebook ) {         $.ajax({           type: 'GET',           url: plugin.settings.url,           async: true,           jsonpCallback: 'GetSocialFeed',           contentType: "application/json",           dataType: 'jsonp',           data: {             'twitter': plugin.settings.twitter,             'twitterID': plugin.settings.twitterID,             'twitterHashtag': plugin.settings.twitterHashtag,             'facebook': plugin.settings.facebook,             'facebookID': plugin.settings.facebookID,             'items_total': plugin.settings.items_total           },           success: function(data) {             deferred.resolve(data);           },           fail: function(data, error) {             deferred.reject(error);           }         });       } else {         deferred.reject('You haven\'t specified what to fetch. Set twitter to true, facebook to true, or both to true.');       }        return deferred.promise();     };      var renderHtml = function(data) {         var htmlstring = '';         htmlstring += '<ul>';         for( var i = 0; i < data.length; i++ ) {           htmlstring += '<li class="post_' + data[i].source + '">';           htmlstring += '<div class="soc_icon"><div class="icon"></div></div>';           htmlstring += '<div class="soc_text">';           htmlstring += '<p class="soc_message">';           htmlstring += '<a href="' + data[i].url + '">';           htmlstring += data[i].user + '</a> ';           htmlstring += data[i].text;           if( data[i].picture )             htmlstring += '<img src="' + data[i].picture + '">';           htmlstring += '</p>';           htmlstring += '<p class="timeago" title="' + data[i].created_at + '"></p>';           htmlstring += '</div>';           htmlstring += '</li>';         }         htmlstring += '</ul>';          return htmlstring;     };      init();    };  })(jQuery); 
Similar articles

How do twitter giveaways work?

9 months ago - Reply: 2 - Views: 130

How may I get genuine followers on Twitter?

3 years ago - Reply: 33 - Views: 1,832

Login to Twitter sometime fail

7 months ago - Reply: 1 - Views: 27

Twitter doesn't accept PHP's cURL, but Linux'

1 year ago - Reply: 2 - Views: 92

Twitter OAuth on iOS

6 months ago - Reply: 1 - Views: 96

why am i getting an error on .verifyCredentials()

6 months ago - Reply: 1 - Views: 37

TwitteR setup_twitter_oauth() gives an error

6 months ago - Reply: 1 - Views: 31

Tweepy - Getting the author of a retweeted tweet

6 months ago - Reply: 0 - Views: 7

Retrieving data from twitter with JavaScript

6 months ago - Reply: 0 - Views: 4

Combined social media feed returning the wrong data

6 months ago - Reply: 0 - Views: 3

Django and Twitter request_token

6 months ago - Reply: 0 - Views: 3

Python HMAC hashed value encoding to base64

6 months ago - Reply: 1 - Views: 35

At the rate symbol in facebook

6 months ago - Reply: 0 - Views: 3

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re