Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define('WP_DEBUG',true);
- define('dtni_REGISTRATION_INCLUDE_URL', plugin_dir_url(__FILE__).'includes/');
- ob_start();
- //add front end css and js
- function dtni_slider_trigger(){
- wp_enqueue_style('dtni_css_and_js', dtni_REGISTRATION_INCLUDE_URL."front-style.css");
- wp_register_script('dtni_css_and_js', dtni_REGISTRATION_INCLUDE_URL."font-script.js" );
- wp_enqueue_script('dtni_css_and_js');
- }
- add_action('wp_footer','dtni_slider_trigger');
- // function to registration Shortcode
- function dtni_registration_shortcode( $atts ) {
- global $wpdb, $user_ID;
- $firstname='';
- $lastname='';
- $username='';
- $email='';
- /* //if looged in rediret to home page
- if ( is_user_logged_in() ) {
- wp_redirect( get_option('home') );// redirect to home page
- exit;
- } */
- if(sanitize_text_field( $_POST['com_submit']) != ''){
- $keresztnév=sanitize_text_field( $_REQUEST['com_firstname'] );
- $családnév=sanitize_text_field( $_REQUEST['com_lastname'] );
- $username = sanitize_text_field( $_REQUEST['com_username'] );
- $email = sanitize_text_field( $_REQUEST['com_email'] );
- $password = $wpdb->escape( sanitize_text_field( $_REQUEST['com_password']));
- $status = wp_create_user($username,$password,$email);
- $succress ='';
- $error_msg='';
- if (is_wp_error($status)) {
- $error_msg = __('Username or Email already registered. Please try another one.','');
- }
- else{
- $user_id=$status;
- update_user_meta( $user_id,'first_name', $fullname);
- update_user_meta( $user_id,'last_name', $családnév);
- $succress= __('Your are register successfully for this site.','');
- $user_info=get_userdata( $user_id );
- wp_mail($user_info->user_email, 'User first and last name', sprintf('Hi we have added your first name :-% and last name:- % to our site.',$_POST['fullname']));
- }
- }
- ?>
- <div class="digtalthinkersni-registration-form">
- <?php if($error_msg!='') { ?><div class="error"><?php echo $error_msg; ?></div><?php } ?>
- <?php if($succress!='') { ?><div class="success"><?php echo $succress; ?></div><?php } ?>
- <form name="form" id="registration" method="post">
- <div class="ftxt">
- <label><?php _e("Keresztnév: *",'');?></label>
- <input id="com_firstname" name="com_firstname" type="text" class="input" required value=<?php echo $keresztnév; ?> >
- </div><div class="ftxt">
- <label><?php _e("Családnév: *",'');?></label>
- <input id="com_fullname" name="com_lastname" type="text" class="input" required value=<?php echo $családnév; ?> >
- </div>
- <div class="ftxt">
- <label><?php _e("Felhasználói név :*",'');?></label>
- <input id="com_username" name="com_username" type="text" class="input" required value=<?php echo $username; ?> >
- </div>
- <div class="ftxt">
- <label><?php _e("E-mail: *",'');?> </label>
- <input id="com_email" name="com_email" type="email" class="input" required value=<?php echo $email; ?> >
- </div>
- <div class="ftxt">
- <label><?php _e("Jelszó :*",'');?></label>
- <input id="password1" name="com_password" type="password" required class="input" />
- </div>
- <div class="ftxt">
- <input id="password2" name="c_password" type="password" class="input" />
- <label><?php _e("Jelszó még egyszer: * ",'');?></label>
- </div>
- <div class="ftxt">
- <label>
- <?php _e("Newsletter Signup : ",'');?>
- <input type="checkbox" name="mc4wp-subscribe" value="1" />
- </label>
- </div>
- <input type="hidden" name="action" id="action" value="hideme" />
- <div class="fbtn"><input type="submit" name='com_submit' class="button" value="<?php _e("Regisztráció",'');?>"/> </div>
- </form>
- </div>
- <?php
- }
- //add registration shortcoode
- add_shortcode( 'digtialthinkers-registration-form', 'dtni_registration_shortcode' );
- ?>
- if ( !function_exists('wp_new_user_notification') ) :
- /**
- * Pluggable - Email login credentials to a newly-registered user
- *
- * A new user registration notification is also sent to admin email.
- *
- * @since 2.0.0
- *
- * @param int $user_id User ID.
- * @param string $plaintext_pass Optional. The user's plaintext password. Default empty.
- */
- function wp_new_user_notification($user_id, $plaintext_pass = ''){
- $user = get_userdata($user_id);
- // The blogname option is escaped with esc_html on the way into the database in sanitize_option
- // we want to reverse this for the plain text arena of emails.
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
- $message = sprintf(__('New user registration on your site %s:'), $blogname) . "rnrn";
- $message .= sprintf(__('Username: %s'), $user->user_login) . "rnrn";
- $message .= sprintf(__('E-mail: %s'), $user->user_email) . "rn";
- @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
- if ( empty($plaintext_pass) )
- return;
- $message = sprintf(__('Username: %s'), $user->user_login) . "rn";
- $message .= sprintf(__('Password: %s'), $plaintext_pass) . "rn";
- $message .= wp_login_url() . "rn";
- wp_mail($user->user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement