开发者

Delete facebook comment from my site or facebook Javascript SDK

I am using facebook javascript SDK to post comment on facebook and using this code:

FB.init({
            //appId: 'YOUR_APP_ID', cookie:开发者_运维知识库 true,
            appId: '2697XXXXXXXXXX098', cookie: true,
            status: true, xfbml: true
        });

                FB.ui({
                    method: 'feed',
                    name: 'MyComment',
                    link: 'http://www.facebook.com./',
                    picture: 'http://xyz.com/App_Shared/Images/logo.jpg',
                    caption: 'Comment caption',
                    description: 'comment description',
                    message: 'Join facebook.'
                }, function (response) {
                    if (response && response.post_id) {
                        alert('Post was published.' + response.post_id);
                    } else {
                        alert('Post was not published.');
                    }
                });

and now i want to delete this post by using the same type of js code. I saved post_id in my database.

Can you provide me the code or any URL to do this.....


First of all you must give to access to you application and allow by user according to this URL

http://developers.facebook.com/docs/reference/api/permissions/

These permission you can use like this method

 FB.login(function (response) {
            if (response.authResponse) {
                FB.api('/me', function (response) {
                    jQuery('#hdfUID1').val(response.id);
                    jQuery('#btnFBLoginTemp').click();
                    //                        FB.logout(function (response) {
                    //                        });
                });
            } else {
                jQuery('#hdfUID1').val('');
            }
        }, { scope: 'email,user_photos,read_stream,publish_stream,offline_access' });

if user allow these permissions then you can delete comment from user's wall which was posted by your application by using "Anatoly Lubarsky" answer method....

FB.api(postId, 'delete', function(response) {
    // callback here
});


should be very simple like:

FB.api(postId, 'delete', function(response) {
    // callback here
});

hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜