Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Mar 2011
    Posts
    215
    Thanks
    10
    Thanked 1 Time in 1 Post

    Adding form links into a php form **RESOLVED**

    Im working on the blanco theme for wordpress and their customer service has been just a sea of " nope, you cant do that" to their theme.. I'm trying to add some text and a few links in their registration form template and so far haven't had any luck

    The form is set us as follows:

    PHP Code:
    <?php
    /**
     * Template Name: Custom Registration Page
     */
    require_once(ABSPATH WPINC '/registration.php');
    global 
    $wpdb$user_ID;
    //Check whether the user is already logged in
    if (!$user_ID) {
        if(
    $_POST){
            
    //We shall SQL escape all inputs
            
    $username $wpdb->escape($_REQUEST['username']);
            if(empty(
    $username)) {
                echo 
    "<span class='error'>".__"User name should not be empty."ETHEME_DOMAIN )."</span>";
                exit();
            }
            
    $email $wpdb->escape($_REQUEST['email']);
            if(!
    preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/"$email)) {
                echo 
    "<span class='error'>".__"Please enter a valid email."ETHEME_DOMAIN )."</span>";
                exit();
            }
            
    $pass $wpdb->escape($_REQUEST['pass']);
            
    $pass2 $wpdb->escape($_REQUEST['pass2']);
            if(empty(
    $pass) || strlen($pass) < 5) {
                echo 
    "<span class='error'>".__"Password should have more than 5 symbols"ETHEME_DOMAIN )."</span>";
                exit();
            }
            if(
    $pass != $pass2) {
                echo 
    "<span class='error'>".__"The passwords do not match"ETHEME_DOMAIN )."</span>";
                exit();
            }
            
            
    $status wp_create_user$username$pass$email );
            if ( 
    is_wp_error($status) )
                echo 
    "<span class='error'>".__"Username already exists. Please try another one."ETHEME_DOMAIN )."</span>";
            else {
                
    $from get_option('admin_email');
                
    $headers 'From: '.$from "\r\n";
                
    $subject "Registration successful";
                
    $msg "Registration successful.\nYour login details\nUsername: $username\nPassword: $random_password";
                
    wp_mail$email$subject$msg$headers );
                echo 
    "<span class='success'>".__"Please check your email for login details."ETHEME_DOMAIN )."</span>";
            }
            exit();
        } else {
            
    get_header();
            
    ?>
            <section id="main" class="columns2-left">
                <div class="content">
                    <div class="entry-content">
                        <?php
                        
    if(get_option('users_can_register')) {
                            
    ?>
                            <h1><?php the_title(); ?></h1>
                            <div id="result"></div> 
                            
                            <form id="wp_signup_form" action="" method="post" class="login">
                                <div class="login-fields">
                                    <p class="form-row form-row-first">
                                        <label><?php _e"Username"ETHEME_DOMAIN ?> <span class="required">*</span></label>
                                        <input type="text" name="username" class="text" value="" />
                                    </p>
                                    <p class="form-row">
                                        <label><?php _e"Email address"ETHEME_DOMAIN ?> <span class="required">*</span></label>
                                        <input type="text" name="email" class="text" value="" />
                                    </p>
                                    <p class="form-row">
                                        <label><?php _e"Password"ETHEME_DOMAIN ?> <span class="required">*</span></label>
                                        <input type="password" name="pass" class="text" value="" />
                                    </p>
                                    <p class="form-row form-row-last">
                                        <label><?php _e"Re-enter password"ETHEME_DOMAIN ?> <span class="required">*</span></label>
                                        <input type="password" name="pass2" class="text" value="" />
                                    </p>
                                    <div class="clear"></div>
                                </div>
                                <p class="form-row">
                                    <button class="button fl-r submitbtn" type="submit"><span><?php _e"Register"ETHEME_DOMAIN ?></span></button>
                                    <div class="clear"></div>
                                </p>
                            </form>
                            <script type="text/javascript">
                                jQuery(".submitbtn").click(function() {
                                    jQuery('#result').html('<img src="<?php bloginfo('template_url'); ?>/images/loading.gif" class="loader" />').fadeIn();
                                    var input_data = jQuery('#wp_signup_form').serialize();
                                    jQuery.ajax({
                                        type: "POST",
                                        url: "<?php echo (is_ssl()) ? "https://" "http://" ; echo $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>",
                                        data: input_data,
                                        success: function(msg){
                                            jQuery('.loader').remove();
                                            jQuery('<div>').html(msg).appendTo('div#result').hide().fadeIn('slow');
                                            jQuery('#wp_signup_form').find("input[type=text], input[type=password], textarea").val("");
                                        }
                                    });
                                    return false;
                                });
                            </script>
                            <?php
                        
    }
                        else 
    _e'<span class="error">Registration is currently disabled. Please try again later.<span>'ETHEME_DOMAIN );
                        
    ?>
                    </div>
                </div><!-- #content -->
                <aside id="sidebar">
                    <?php get_sidebar(); ?>
                </aside>
                <div class="clear"></div>
            </section><!-- #container -->
            <?php
            get_footer
    ();
        } 
    //end of if($_post)
    }
    else {
        echo 
    "<script type='text/javascript'>window.location='"home_url() ."'</script>";
    }
    ?>
    All I want to add is this
    Code:
    For military pricing, please send the following forms and any pertaining documentation to info@alliance.com or call 1-844-743-6227 for more information.
    
    <a style="color:000;"  href="http://www.alliance-fl.com/wp-content/uploads/2014/04/Alliance-Credit-Application.pdf"> Alliance Credit Application</a>
    
    <a style="color:000;" href="http://www.alliance-fl.com/wp-content/uploads/2014/04/Alliance-RMA-Form.pdf"> Alliance RMA Form</a>
    Is there an easy way to do this?
    Last edited by lmorales; 04-15-2014 at 09:02 PM. Reason: issue has been resolved


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •