I'm trying to get the user_meta to be updated based on the custom post field type. However the information won't transfer if the new post is published by a user through a frontend form.
Currently it only works if you update a listing via the front end form, or publish/edit a post via the backend of wordpress.
function update_package_id($post_id) {
$post = get_post($post_id);
$author = get_userdata($post->post_author);
$author_email = $author->user_email;
$package_id = get_post_meta( $post->ID, 'package_pid', true );
$user_id = $author->ID;
update_user_meta($user_id, 'package_type', $package_id);
if (function_exists( 'AC_OnUpdateUser' )) {
$user = new WP_User( $user_id );
AC_OnUpdateUser( $user->ID, $user, FALSE );
}
}
add_action( 'publish_place', 'update_package_id' );
The second function fires the information into mailchimp. Am I using the wrong action in wordpress?
save_post
instead and see if it works for you.