admin管理员组文章数量:1405164
I want to add a custom text field in the BuddyPress activity form and save it. I can add it with this code:
add_action ( "bp_after_activity_post_form", 'my_test_function' );
function my_test_function(){
echo '<div id="tags-content">
<input type="text" name="tags" value="" />
</div>';
}
How can I save it? I'm trying this, but it never goes to it.
add_action('bp_activity_after_save', 'where_activity_from', 10, 3);
function where_activity_from( $activity ) {
echo "test";
//die;
}
I want to add a custom text field in the BuddyPress activity form and save it. I can add it with this code:
add_action ( "bp_after_activity_post_form", 'my_test_function' );
function my_test_function(){
echo '<div id="tags-content">
<input type="text" name="tags" value="" />
</div>';
}
How can I save it? I'm trying this, but it never goes to it.
add_action('bp_activity_after_save', 'where_activity_from', 10, 3);
function where_activity_from( $activity ) {
echo "test";
//die;
}
Share
Improve this question
asked Dec 20, 2019 at 19:03
HuanHuan
111 bronze badge
1
- 3rd party plugin questions are off-topic, try buddypress/support – RiddleMeThis Commented Dec 20, 2019 at 19:40
1 Answer
Reset to default 1First of all, there is only 1 $accepted_args
, not 3, so the add_action
is:
add_action('bp_activity_after_save', 'where_activity_from', 10, 1);
Second, the value in your tags
input is never parsed by BP_Activity_Activity->save()
so how could it be part of the array available thru the hook?
Try using the $_POST
array, like this:
add_action('bp_activity_after_save', 'where_activity_from', 10, 1);
function where_activity_from( $activity ) {
// write_log( $_POST['tags'] );
// do something with $_POST['tags']
}
本文标签: Add an extra field to BuddyPress activity form
版权声明:本文标题:Add an extra field to BuddyPress activity form 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744886756a2630533.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论