简体   繁体   English

Facebook php sdk发布到用户墙显示用户到用户

[英]Facebook php sdk post to user wall show user to user

I using Facebook php sdk to post to users wall 我使用Facebook PHP SDK张贴到用户墙

$userId = $_POST["chckuser"][$i];
$facebook->api('/'.$userId.'/feed', 'post', array('message' => 'Hi'));

and i using this permissions : 我使用此权限:

$loginUrl =$facebook>getLoginUrl(array('redirect_uri'=>$homeurl,'scope'=>'publish_stream,user_groups,manage_pages'));

But appears in the user's wall "User to user" 但是出现在用户的墙上“用户到用户”

The problem appears in this image 问题出现在此图像中

http://i.imm.io/TA9F.jpeg http://i.imm.io/TA9F.jpeg

What is the problem please and thank u 请问是什么问题,谢谢

From the image I can see that the current user and the user with id $userId are different users. 从该图像中,我可以看到当前用户和ID $userId的用户是不同的用户。 If you want to post to current user's wall (and you sound like you want to do it like that) you don't have to check you can simple use me/feed : 如果您想发布到当前用户的墙上(听起来像是要这样做),则无需检查即可简单地使用me/feed

$facebook->api('/me/feed', 'post', array('message' => 'Hi'));

This will post to the wall of user that is authed and is currently using your app. 这将发布到已通过身份验证且当前正在使用您的应用程序的用户墙上。

$userId = $_POST["chckuser"][$i];

This is your problem. 这是你的问题。 You are posting to somebody else's wall. 您正在张贴到其他人的墙上。 If you post to somebody else's wall, you will get the user to user message. 如果您张贴到其他人的墙上,您将获得用户到用户的消息。 It isn't a bug, its a very sensible feature. 它不是错误,而是非常明智的功能。

As Konrad said above, just post to /me/feed instead. 正如Konrad所说,只需将其发布到/ me / feed即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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