Hey fellows here is the situation:
we have defined 2 custom types (person and company), also a custom type of NtoN relationship btw person and company. the defined person custom type has 1to1 relationship with USER in WORDPRESS. now what we need to do is to sync info of wordpress user registeration to custom type person, is there an API to perform this kind of task? or is there any way that we can perform CRED operation without using the CRED form?
You will need to create a custom field to store the user ID in Person CPT. This connection can be done when a CRED form is submitted to add a Person. There is a hook called cred_submit_complete that lets you to execute some code when a form is submitted:
function my_success_action($post_id, $form_data)
// if a specific form
$idUser = wp_create_user( $_POST['wpcf-user_name'], $_POST['password'], $_POST['wpcf-email_address'] );
add_post_meta($post_id, 'wpcf-user_id, $idUser, true);
The code above should be added in functions.php of your theme. You need to replace "101" with the correct ID of the CRED form and replace the variables to username, password and email. I also created a custom field in Persons called wpcf-user_id to store the wordpress user ID. The connection is ready, is it what you want to do?
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.