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']
}