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 15 topics - 166 through 180 (of 211 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 );
}
Problem:
The user would like to remove the username field from a registration form.
Solution:
The username is required by WordPress, and you are right, it is read-only. It can't be changed in WordPress once it is created.
In Toolset forms, you can choose to auto-generate the username, that will allow you to remove the field from the form. Check this screenshot http://prntscr.com/tal54z
But you will have to switch to expert mode to do that.
Problem:
The user would like to hide the nickname in a user form and automatically copy the email to the nickname.
Solution:
- Hide the nickname from the form options.
- Add the following code to copy the user email to the nickname:
/* update nickname field with the value of user_login. */
function my_copy_nickame_from_username( $user_id ) {
$user = get_user_by( 'id', $user_id);
update_user_meta( $user_id, 'nickname', $user->user_login );
}
add_action( 'user_register', 'my_copy_nickame_from_username' );