2014-02-10 53 views
1

我想筛选并显示我的朋友状态更新,其中包含帖子中包含的位置/地点。我已经尝试了很多次迭代,但无法获取显示的位置(除了'id'之外的地方),我只想显示包含实际位置的朋友发布的状态更新,我试图从'流' 。以“地方”和“location_post”没有运气任何帮助,将不胜感激这是代码:显示地点/位置名称而不是ID

window.fbAsyncInit = function() { 
    FB.init({ 
     appId: '<?= $sApplicationId ?>', 
     status: true, 
     cookie: true, 
     xfbml: true, 
     oauth: true 
    }); 

    function updateButton(response) { 
     var button = document.getElementById('fb-auth'); 

     if (response.authResponse) { 
      var userInfo = document.getElementById('user-info'); 
      var iPid = 0; 
      FB.api('/me', function (response) { 
       userInfo.innerHTML = '<img src="https://graph.facebook.com/' + response.id + '/picture">' + response.name; 
       button.innerHTML = 'Logout'; 

       // get friends activity feed 
       iPid = response.id; 
       if (iPid > 0) { 
        FB.api({ // call fql.query 
         method: 'fql.query', 
         query: "SELECT post_id, actor_id, type, description, place, permalink, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE  uid = me() AND type = 'newsfeed') ORDER BY place DESC" 
        }, function (response) { 

         $('#results').html(
         $('#facebookTemplate').render(response)); 
        }); 
       } 
      }); 

      button.onclick = function() { 
       FB.logout(function (response) { 
        window.location.reload(); 
       }); 
      }; 
     } else { 
      button.onclick = function() { 
       FB.login(function (response) { 
        if (response.authResponse) { 
         window.location.reload(); 
        } 
       }, { 
        scope: 'read_stream' 
       }); 
      } 
     } 
    } 

    FB.getLoginStatus(updateButton); 
    FB.Event.subscribe('auth.statusChange', updateButton); 
}; 

(function() { 
    var e = document.createElement('script'); 
    e.async = true; 
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; 
    document.getElementById('fb-root').appendChild(e); 
}()); 
+0

这里是代码: – user3291159

+0

你想表达什么?发布信息与地点信息混合? – Tobi

回答

0

我觉得有没有直接的方法来做到这一点,但你可以加入柱和地方在客户端信息:

帖子:

SELECT post_id, actor_id, type, description, place, permalink, message from stream where post_id in (select post_id from location_post where author_uid in (select uid2 from friend where uid1=me()) and post_id) 

地点:

SELECT page_id, location from page where page_id in (select page_id from location_post where author_uid in (select uid2 from friend where uid1=me()) and post_id) 

加入应该在posts.place = places.page_id键上。

相关问题