How we can get the success messages like we can get the error messages by simple using the variable $error . So there is any other variable like $success. Currently i am using this code to register a new user. so after registeration i want to display success message.
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'adduser' ) {
$user_pass = wp_generate_password();
$userdata = array(
'user_login' => esc_attr( $_POST['user_name'] ),
'user_pass' => esc_attr( $_POST['pass1'] ),
'user_email' => esc_attr( $_POST['email'] ),
'user_url' => esc_attr( $_POST['website'] ),
'description' => esc_attr( $_POST['description'] ),
'role' => get_option( 'default_role' ),
);
if ( !$userdata['user_login'] )
$error = __('A username is required for registration.', 'frontendprofile');
elseif ( username_exists($userdata['user_login']) )
$error = __('Sorry, that username already exists!', 'frontendprofile');
elseif ( !is_email($userdata['user_email'], true) )
$error = __('You must enter a valid email address.', 'frontendprofile');
elseif ( email_exists($userdata['user_email']) )
$error = __('Sorry, that email address is already used!', 'frontendprofile');
else if ( $_POST['pass1'] !== $_POST['pass2'] ) {
$error = __('Sorry, Passwords must match', 'frontendprofile');
}
else if ( strlen( $_POST['pass1'] ) < 6 ) {
$error = __('Sorry, Passwords must be at least six characters long', 'frontendprofile');
}
else{
$new_user = wp_insert_user( $userdata );
wp_new_user_notification($new_user, $user_pass);
}
}