facebook api获取用户相册,wordpress页面中的照片

时间:2014-07-15 22:30:11

标签: php facebook wordpress facebook-graph-api

我正在开发一个Wordpress页面,以使用Facebook API获取用户相册和每张专辑的照片

这是我的代码:

    function myFBcall(){
         FB.login(function(response) {
              console.log(response);
              if (response.authResponse) {
                   console.log('Welcome!  Fetching your information.... ');
                   FB.api('/me?fields=id,name,albums,photos', function(myalb) {

                   console.log(myalb);
                   jQuery( "#facebookimages" ).html('<h3>My Albums :</h3>');    

                   jQuery.each( myalb.albums.data, function( i, val ) {
                   /* make the API call */
                   FB.api(
                        "/"+val.id+"/picture",
                        function (mycover) {
                             if (mycover && !mycover.error) {

                         jQuery( "#facebookimages" ).append( "<div class='myalbum'
                         onClick='javascript:getmyphotos(\""+val.id+"\",\""+val.name+"\")' ><img src='"+mycover.data.url+"' width='90%' height='90%'/>"+val.name+"</div>" );    
                             }
                        }
                  );
                  });
             });
          } else {
               console.log('User cancelled login or did not fully authorize.');
          }
    },{ 'scope': 'user_photos,publish_actions','return_scopes': true });
    }

与在我的Facebook应用中注册为开发人员或管理员的用户正常工作

但不使用我的WordPress用户

如何让它与我的wordpress网站中的所有用户合作?

任何帮助??

1 个答案:

答案 0 :(得分:0)

  

While I don't have specific knowledge about wordpress, in general, you would need to ask those permissions. If your app was created after april 30, asking for extended permissions require Facebook approval. Read more here: developers.facebook.com/blog/post/2014/04/30/… – Ibrahim yesterday

谢谢你Ibrahim,你的回复是和我在一起,我要求(user_photos)许可和facebook批准,现在正在工作,