Email is required.

'; } elseif ( ! is_email( $user_email ) ) { $err .= '

This email is not valid.

'; } elseif ( email_exists( $user_email ) ) { $err .= '

This email already exists.

'; } return $err; } //custom register compare password function custom_registration_compare_password( $password, $confirm_password ){ $err = ""; if ($password != $confirm_password ) $err .= "

Passwords do not match.

"; return $err; } function get_terms_conditions( $page_id ){ $agree = get_page( $page_id ); $output = ""; $output .= '
'; $output .= '

' . $agree->post_title . '

'; $output .= apply_filters ( 'the_content', $agree->post_content ); $output .= '
'; //agree form $output .= '
'; $output .= '
'; $output .= '

'; $output .= ''; $output .= 'You must agree with these terms and conditions before you can proceed.'; $output .= '

'; $output .= '

'; $output .= ''; $output .= '

'; $output .= '
'; $output .= '
'; return $output; } function get_register_form(){ $output = ""; $username = ""; if( isset( $_POST['username'] ) && ( $_POST['username'] != "" ) ): $username = $_POST['username']; endif; $firstname = ""; if( isset( $_POST['firstname'] ) && ( $_POST['firstname'] != "" ) ): $firstname = $_POST['firstname']; endif; $lastname = ""; if( isset( $_POST['lastname'] ) && ( $_POST['lastname'] != "" ) ): $lastname = $_POST['lastname']; endif; $email = ""; if( isset( $_POST['email'] ) && ( $_POST['email'] != "" ) ): $email = $_POST['email']; endif; if ( isset( $_POST['registersubmit'] ) ): $output .= do_registration(); endif; $output .= '
'; $output .= '

Create a new account

'; $output .= '

Note: Fields marked with (*) are required.

'; $output .= '
'; $output .= '

'; $output .= ''; $output .= ''; $output .= '

'; $output .= '

'; $output .= ''; $output .= ''; $output .= '

'; $output .= '

'; $output .= ''; $output .= ''; $output .= '

'; $output .= '

'; $output .= ''; $output .= ''; $output .= '

'; $output .= '

'; $output .= ''; $output .= ''; $output .= '

'; $output .= '

'; $output .= ''; $output .= ''; $output .= '

'; $output .= '

'; $output .= ''; $output .= '

'; $output .= '
'; $output .= '
'; return $output; } function register_success_message(){ $output = ""; $output .= '
'; $output .= '

You have been registered successfully.

'; $output .= '

Please check your email to confirm your account.

'; $output .= '
'; $output = apply_filters('register_success_message', $output); return $output; } function custom_registration_send_mail( $user_email, $first_name, $user_name, $password, $user_id ){ $subject = ""; $message = ""; $status = get_user_meta( $user_id, 'user_status', true ); if ( $status == "pending" ){ $subject = sprintf(__("Please confirm your account")); $message .= sprintf(__("Hello, \r\n\r\n")); $message .= sprintf(__("You have registered at %s. "), get_option( 'blogname' )); $message .= sprintf(__("Please click the link below to confirm your account:\r\n\r\n")); $message .= sprintf(__('%s'), site_url('/confirm-user?uid=' . $user_id)); $messsage = apply_filters( 'confirm_email_message', $message ); $subject = apply_filters( 'confirm_email_subject', $subject ); }else{ $subject = sprintf(__('Your username and password')); $message .= sprintf( "Welcome %s", $first_name ) . "\r\n\r\n"; $message .= sprintf( "Thank you for registering at: %s", get_site_url() ); $message .= "\r\n\r\nHere is your login detail: \r\n\r\n"; $message .= sprintf( "Username: %s", $user_name ) . "\r\n"; $message .= sprintf( "Password: %s", $password ); $messsage = apply_filters( 'register_email_message', $message ); $subject = apply_filters( 'register_email_subject', $subject ); } $headers[] = 'From: ' . get_option( 'blogname' ) . ' <'. get_option('admin_email') .'>'; $headers = apply_filters( 'custom_registration_email_header', $headers ); wp_mail( $user_email, $subject, $message, $headers ); } function request_confirm_email_form( $args = array() ){ $msg = ""; if ( isset( $_POST['confirm_email'] ) ){ $email = isset( $_POST['user_email'] ) ? trim( $_POST['user_email'] ) : ""; if ( is_email( $email ) ){ //send the confirm email $msg = request_confirm_email( $email ); }else{ $msg = '
Invalid email address.
'; } } $form = $msg; $form .= '
'; $form .= '

'. $args['fill_in_message'] .'

'; $form .= '

'; $form .= '

'; $form .= '
'; return $form; } function request_confirm_email( $email ){ $subject = ""; $message = ""; $user = get_user_by( 'email', $email ); $user_id = isset( $user->ID ) ? $user->ID : ""; $status = get_user_meta( $user_id, 'user_status', true ); $info = ""; if ( $status == "pending" ){ $subject = sprintf(__("Please confirm your account")); $message .= sprintf(__("Hello, \r\n\r\n")); $message .= sprintf(__("You have registered at %s. "), get_option( 'blogname' )); $message .= sprintf(__("Please click the link below to confirm your account:\r\n\r\n")); $message .= sprintf(__('%s'), site_url('/confirm-user?uid=' . $user_id)); $messsage = apply_filters( 'confirm_email_message', $message ); $subject = apply_filters( 'confirm_email_subject', $subject ); $headers[] = 'From: ' . get_option( 'blogname' ) . ' <'. get_option('admin_email') .'>'; $headers = apply_filters( 'custom_registration_email_header', $headers ); wp_mail( $email, $subject, $message, $headers ); $info = '
A confirmation email is sent, please check your email.
'; $info = apply_filters( 'confirmation_email_success_message', $info ); }else{ $info = '
'; $output .= get_terms_conditions( $pageid ); } else: $output .= get_register_form(); endif; else: $output .= '

You are a member of '. get_bloginfo('sitename') .' already.

'; $output = apply_filters( 'already_register_message', $output ); endif; else: $output .= '

You must enable user registration from WordPress admin in General Settings.

'; $output = apply_filters( 'enable_registration_message', $output ); endif; return $output; } /** end */