Jump to content

David38ni

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by David38ni

  1. I have this wordpress plugin im working on but what i want it to do is to hide the form on submit but its not working its still showing the form can anbody help. I am wanting to hide the form after submition

    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' );
    	
    ?>
    
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.