[Resolved] Form updating but with cred_save_data no update_post_meta
This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
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.