简体   繁体   中英

facebook api to get user albums , photos in wordpress page

I am developing a Wordpress page to get user albums, and photos for each album using Facebook API

Here is my code :

    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 });
    }

its working correctly with user registered in my Facebook app as developer or administrator

but not working with my WordPress users

how to make it working with all users in my wordpress website ??

any help ??

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

谢谢易卜拉欣,您的答复使我感到困惑,我请求(user_photos)许可和facebook批准,现在它可以工作,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM