Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Gravity Forms Username
- add_filter( 'gform_username', 'auto_username', 10, 4 );
- function auto_username( $username, $feed, $form, $entry ) {
- $username = strtolower( rgar( $entry, '2.3' ) . rgar( $entry, '2.6' ) );
- if ( empty( $username ) ) {
- return $username;
- }
- if ( ! function_exists( 'username_exists' ) ) {
- require_once( ABSPATH . WPINC . '/registration.php' );
- }
- if ( username_exists( $username ) ) {
- $i = 2;
- while ( username_exists( $username . $i ) ) {
- $i++;
- }
- $username = $username . $i;
- };
- return $username;
- }
- // Redefine user notification function
- if ( !function_exists('wp_new_user_notification') ) {
- function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
- $user = new WP_User($user_id);
- $user_login = stripslashes($user->user_login);
- $user_email = stripslashes($user->user_email);
- $user_firstname = stripslashes($user->user_firstname);
- if ( empty($plaintext_pass) )
- return;
- //$message = __('Hi there,') . "\r\n\r\n";
- $message .= sprintf(__("Beste %s,"), ucfirst($user_firstname)) . "\r\n\r\n";
- $message .= sprintf(__("Bedankt voor het aanmaken van een account op %s!"), get_option('blogname')) . "\r\n\r\n";
- $message .= sprintf(__('Je gebruikersnaam is: %s'), $user_email) . "\r\n";
- $message .= sprintf(__('Je wachtwoord is automatisch gegenereerd: %s'), $plaintext_pass) . "\r\n\r\n";
- $message .= sprintf(__('Je kunt je account hier raadplegen om je bestellingen te bekijken en je wachtwoord te wijzigen: https://www.30kiloafvallen.nl/my-account/.'), get_option('admin_email')) . "\r\n\r\n";
- $message .= __('Tot snel!');
- wp_mail($user_email, sprintf(__('[%s] Uw Gebruikersnaam en Wachtwoord'), get_option('blogname')), $message);
- }
- }
- //Auto login after registration
- function auto_login_new_user( $user_id ) {
- wp_set_current_user($user_id);
- wp_set_auth_cookie($user_id);
- // You can change home_url() to the specific URL,such as
- //wp_redirect( 'http://www.wpcoke.com' );
- wp_redirect( 'https://www.30kiloafvallen.nl/product-categorie/afslanken/' );
- exit;
- }
- add_action( 'user_register', 'auto_login_new_user' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement