fb.ui 发送方法不适用于 facebook 中的测试用户
我正在使用 javascript SDK 来触发 fb.ui 的发送方法。如果我以自己的身份登录并将消息发送给团队中的其他开发人员,它就可以工作。当我以测试用户身份登录并发送给另一个测试用户时,没有错误,但接收者从未收到消息。
下面的代码显示了我的按钮的点击事件:
$(".invite_fb_friends").click(function() {
<?php
$subject = __("Please check out Volved", "volved", "volved");
if (isset($current_user->volved_cause)) {
$p = get_post($current_user->volved_cause);
$invite_id = get_user_personal_invite();
$description = sprintf(__("Follow this link and join me in supporting %s, or a cause of your choice!"),
$p->post_title);
$link = site_url("/cause/". $p->post_name . "/?invite_id=" . $invite_id);
$picture = get_bloginfo('template_directory'). '/images/cause_images/' . $p->post_name . '/logo.jpg';
} else {
//No cause chosen
$description = __("If you follow this link, you'll learn about Volved. If you like, sign up and start making a difference.");
$link = site_url("/");
$picture = get_bloginfo('template_directory') . '/images/logo64.png';
}
//call below documented at: https://developers.facebook.com/docs/reference/dialogs/send/
?>
res = FB.ui({
method: 'send',
name: '<?php echo $subject; ?>',
link: '<?php echo $link; ?>',
//picture: '<?php echo $picture; ?>', //Does not seem to work with valid URL. HTML shows URL but no pic displayed. Leaving blank shows picture of sender
//redirect_uri: filling this in creates an error on facebook
description: '<?php echo $description; ?>'
});
});
I'm using the javascript SDK to fire the send method of fb.ui. It works if I'm logged in as myself and send the messages to other developers on my team. When I log on as a test user and send to another test user, there is no error but the receiver never gets the message.
Code below shows click event from my button:
$(".invite_fb_friends").click(function() {
<?php
$subject = __("Please check out Volved", "volved", "volved");
if (isset($current_user->volved_cause)) {
$p = get_post($current_user->volved_cause);
$invite_id = get_user_personal_invite();
$description = sprintf(__("Follow this link and join me in supporting %s, or a cause of your choice!"),
$p->post_title);
$link = site_url("/cause/". $p->post_name . "/?invite_id=" . $invite_id);
$picture = get_bloginfo('template_directory'). '/images/cause_images/' . $p->post_name . '/logo.jpg';
} else {
//No cause chosen
$description = __("If you follow this link, you'll learn about Volved. If you like, sign up and start making a difference.");
$link = site_url("/");
$picture = get_bloginfo('template_directory') . '/images/logo64.png';
}
//call below documented at: https://developers.facebook.com/docs/reference/dialogs/send/
?>
res = FB.ui({
method: 'send',
name: '<?php echo $subject; ?>',
link: '<?php echo $link; ?>',
//picture: '<?php echo $picture; ?>', //Does not seem to work with valid URL. HTML shows URL but no pic displayed. Leaving blank shows picture of sender
//redirect_uri: filling this in creates an error on facebook
description: '<?php echo $description; ?>'
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
测试用户只能向其他测试用户发送消息。如果您的其他用户是真实用户,例如您自己的帐户,则不会发送。
来自脸书:
https://developers.facebook.com/docs/test_users/
Test users can only send messages to other test users. If your other user is a real user, your own account for example, it will not send.
From Facebook:
https://developers.facebook.com/docs/test_users/