I am trying to:
Did a user update form where there are meta fields. Want to update one of them with php coding.
But field get not updated with the hook: update_post_meta
meta_key: wpcf-ansatsom i want to change the meta_value
userform id 1431
add_action('cred_save_data', 'after_save_data_for_form',30,2);
function after_save_data_for_form($post_id, $form_data)
{
switch($form_data['id']) {
case 1431:
global $wpcf, $post;
update_post_meta($post_id, 'wpcf-ansatsom', 2);
break;
default:
//code to be executed if n is different from all labels;
}
}
Regards
Link to a page where the issue can be seen:
I expected to see:
in database a 2
Instead, I got: the same value as it was before
Hello. Thank you for contacting the Toolset support.
That is strange. Do you already have the custom field key available in the postmeta table for the post you are editing? If Yes, this needs to check on your install.
I need access details as well as problem URL where edit form is displayed.
Sorry my mistake,
its a user_meta field i have to change and then mirror it to a "user_post. So i have to keep track of. post_id and user_id!
The problem for me is that there does not exist a relationship between user and posts, there i had to
made a "users_Post" so i can use toolset and relationships. but when insert / update i have to controll both ways between user and user_post.