CRED plugin allows you to build forms for front-end user registration and editing. These forms can include user fields and display them with your HTML styling. They also support input validation and automatic email notifications.
When you ask for help or report issues, make sure to tell us the structure and the settings of your form.
Viewing 14 topics - 166 through 179 (of 179 total)
The issue here is that a specific email address isn't being validated while the other is when registering with a Toolset Form.. Example titi@cannesu.fr and titi@cannes.fr
Solution:
In order for the email to be valid the domain must also be valid. Toolset validation also checks to see if the email domain is valid. If it isn't then the verification of the email will fail.
Problem:
The user collects payment for user registration, he would like to automatically create a post from a custom post type when the user completes the payment. And he would like to pass some data(custom fields) in the user registration form.
Solution:
This requires:
Post custom fields.
User custom fields, similar to the post fields needed.
CRED commerce form for users registration.
Custom code to create the post automatically when the order completes.
The cred_commerce_after_order_completed hook passes a $data object to the hooked function. The order_id is the "transaction_id" in the $data object. The created user is saved in a custom field of the order, called "_cred_post_id". Then we can pull the user fields from the user, create the custom post, and save the custom field values for the post.
Check this sample code:
add_action( 'cred_commerce_after_order_completed', 'my_cred_commerce_after_order_completed', 10, 1 );
function my_cred_commerce_after_order_completed( $data ) {
// get the order id
$order_id = $data['transaction_id'];
// get the user id
$user_id = get_post_meta( $order_id, '_cred_post_id', true);
// get user data to have a title for the post.
$user = get_userdata( $user_id );
// prepare post object
$post = array(
'post_type' => 'user-profile', // <== CPT slug
'post_title' => $user->user_login, // <== post title
'post_status' => 'publish',
'post_author' => $user_id, // <== Author
);
// Insert the post into the database
$post_id = wp_insert_post( $post );
// get user field
$phone = get_user_meta( $user_id, 'wpcf-phone-number', true );
$agency = get_user_meta( $user_id, 'wpcf-agency1', true );
$speciality = get_user_meta( $user_id, 'wpcf-specialty', true );
// create post field
update_post_meta( $post_id, 'wpcf-agency1', $agency );
update_post_meta( $post_id, 'wpcf-phone-number', $phone );
update_post_meta( $post_id, 'wpcf-speciality', $speciality );
}