Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Generate the password and create the user
- $password = wp_generate_password( 12, false );
- $user_id = wp_create_user( $email_address, $password, $email_address );
- //login
- wp_clear_auth_cookie();
- wp_set_current_user ( $user_id );
- wp_set_auth_cookie ( $user_id );
- // Set the role
- $user = new WP_User( $user_id );
- $user->set_role( 'subscriber' );
- //Ready data for linked post type creation
- $new_post = array(
- 'post_content' => $email_address,
- 'post_status' => 'publish',
- 'post_date' => date('Y-m-d H:i:s'),
- 'post_author' => $user_id,
- 'post_title' => $post_name,
- 'post_name' => $post_name,
- 'post_type' => $user_type
- );
- //Create the post
- $account_link_post_id = wp_insert_post($new_post);
- register_post_type(self::POST_TYPE,
- array(
- 'labels' => $labels,
- 'public' => true,
- 'has_archive' => true,
- 'description' => __("Displays applicants and their details"),
- 'supports' => array(
- 'title', 'author'
- ),
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement