dongyi0210 2015-08-08 17:07
浏览 34

Buddypress - 从自定义页面发布到Side-Wide Activity

I am trying to post a comment to the "Site-Wide Activity" page from a custom page. I have been looking around for a solution but nothing works.

How can I post an image and comment using a custom basic script like the one below?

<?php

if (isset($_POST["submitToActivity"])) {

    $arrayPost = [$_POST["imgUrlString"],$_POST["comment-user"] ];

    add_post_type_support( $arrayPost, 'buddypress-activity' );

    echo "$UserName Posted a new comment";

}

?>

<form method="post" name="sendToActivity">
<label>Url Img</label>
<input type="text" id="imgUrlString" name="imgUrlString" />

<label>Comment</label>
<input type="text" id="comment-user" name="comment-user" />

<input type="submit" name="submitToActivity" id="submitToActivity">
</form>
  • 写回答

1条回答 默认 最新

  • doupuchao4256 2015-08-08 22:26
    关注

    add_post_type_support() doesn't save anything, it just declares (in this case) the support of storing some data (new post of that post type) in BuddyPress activity feed. More info about BuddyPress support here. You will need to read the doc about this function here as well, as you are adding support incorrectly.

    It seems, that you need to take a look at bp_activity_add($args);, here is the doc.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度