• Is there any way to merge these two pieces of codes which happened to be two different registration forms together? They are from two different plugins but I need them to be together. I’ve been trying but I keep getting errors and damaged fields.

    <?php
    
    if(is_wp_error($error) && method_exists($error, 'get_error_code')) {
    	$anyerrors = $error->get_error_code();
    	if( !empty($anyerrors) ) {
    		// we have an error - output
    		$messages = $error->get_error_messages();
    		$errormessages = "<div class='alert alert-error'>";
    		$errormessages .= implode('<br/>', $messages);
    		$errormessages .= "</div>";
    	} else {
    		$errormessages = '';
    	}
    } else {
    	$errormessages = '';
    }
    
    ?>
    
    <div id='membership-wrapper'>
    <?php
    	if(!empty($errormessages)) {
    		echo $errormessages;
    	}
    ?>
    <form class="form-membership" action="<?php echo get_permalink(); ?>" method="post">
    
    	<?php do_action( "signup_hidden_fields" ); ?>
    
    	<input type='hidden' name='subscription' value='<?php if(isset($_REQUEST['subscription'])) echo esc_attr($_REQUEST['subscription']); ?>' />
    
    	<fieldset>
    		<legend><?php _e( 'Create an Account', 'membership' ) ?></legend>
    
    			<div class="form-element">
    				<label class="control-label" for="user_login"><?php _e('Choose a Username','membership'); ?></label>
    				<div class="element">
    					<input type="text" class="input-xlarge" id="user_login" name="user_login" placeholder="" value="<?php if(isset($_POST['user_login'])) echo esc_attr($_POST['user_login']); ?>">
    				</div>
    			</div>
    
    			<div class="form-element">
    				<label class="control-label" for="user_email"><?php _e('Email Address','membership'); ?></label>
    				<div class="element">
    					<input type="text" class="input-xlarge" id="user_email" name="user_email" placeholder="" value="<?php if(isset($_POST['user_email'])) echo esc_attr($_POST['user_email']); ?>">
    				</div>
    
    				<p class="help-block"><?php _e('Please enter a new password, and then verify your new password by entering it again.','membership'); ?></p>
    			</div>
    			<div class="form-element">
    				<label class="control-label" for="user_email"><?php _e('Password','membership'); ?></label>
    				<div class="element">
    					<input type="password" class="input-xlarge" id="password" name="password" placeholder="" autocomplete="off">
    				</div>
    			</div>
    
    			<div class="form-element">
    				<label class="control-label" for="user_email"><?php _e('Confirm Password','membership'); ?></label>
    				<div class="element">
    					<input type="password" class="input-xlarge" id="password2" name="password2" placeholder="" autocomplete="off">
    				</div>
    
    				<p class="help-block"><?php _e('Hint: The password should be at least 5 characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).','membership'); ?></p>
    			</div>
    
    		<?php
    			do_action('membership_subscription_form_registration_presubmit_content');
    
    			do_action( 'signup_extra_fields', $error );
    		?>
    
    		<p><input type="submit" value="<?php _e('Register My Account &raquo;','membership'); ?>" class="alignright button <?php echo apply_filters('membership_subscription_button_color', 'blue'); ?>" name="register"></p>
    		<input type="hidden" name="action" value="validatepage1" />
    
    		<a title="Login ?" href="<?php echo wp_login_url( add_query_arg('action', 'registeruser', get_permalink()) ); ?>" class="alignleft" id="login_right"><?php _e('Already have a user account?' ,'membership'); ?></a>
    <?php
    ?>

    AND

    <div class="registration_form" id="registration_form">
    
        <div id="message" class="updated" {if empty($error) } style="display: none;" {/if}>
            {if !empty($error)}
                {$error}
            {/if}
        </div>
    
        <form action="" method="post" id="form_content" >
            <p class="business_name">
                <label class="title" for="business_name">{$labels.business_name}{$required_text}</label>
                <input type="text" id="business_name" name="business_name" value="{if $error }{$vals.business_name}{/if}" />
            </p>
    
            <p class="contact_name">
                <label class="title" for="contact_name">{$labels.contact_name}{$required_text}</label>
                <input type="text" id="contact_name" name="contact_name" value="{if $error }{$vals.contact_name}{/if}" />
            </p>
            <p class="contact_email">
                <label class="title" for="contact_email">{$labels.contact_email}{$required_text}</label>
                <input type="text" id="contact_email" name="contact_email" value="{if $error }{$vals.contact_email}{/if}" />
            </p>
    
            <p class="contact_phone">
                <label class="title" for="contact_phone">{$labels.contact_phone}</label>
                <input type="text" id="contact_phone" name="contact_phone" value="{if $error }{$vals.contact_phone}{/if}" />
            </p>
    
            {if isset($custom_fields) && 0 < $custom_fields|@count }
                {foreach $custom_fields as $key => $value }
    
                    {if 'hidden' == $value.type}
                        {$value.field}
                    {elseif 'checkbox' == $value.type || 'radio' == $value.type }
                        <p>
                            {if !empty($value.label) }
                                {$value.label}
                            {/if}
                            {if !empty($value.field) }
                                {foreach $value.field as $field }
                                    {$field}<label class="title">&nbsp;</label>
                                {/foreach}
                            {/if}
                            {if !empty($value.description) }
                                {$value.description}
                            {/if}
                        </p>
                    {else}
                        <p>
                            {if !empty($value.label) }
                                {$value.label}
                            {/if}
                            {if !empty($value.field) }
                                {$value.field}
                            {/if}
                            {if !empty($value.description) }
                                {$value.description}
                            {/if}
                        </p>
                    {/if}
    
                {/foreach}
            {/if}
    
            <hr />
            <p class="contact_username">
                <label class="title" for="contact_username">{$labels.contact_username}{$required_text}</label>
                <input type="text" id="contact_username" name="contact_username" value="{if $error }{$vals.contact_username}{/if}" />
            </p>
    
            <p class="contact_password">
                <label class="title" for="contact_password">{$labels.contact_password}{$required_text}</label>
                <input type="password" id="contact_password" name="contact_password" value="" />
            </p>
    
            <p class="contact_password2">
                <label class="title" for="contact_password2">{$labels.contact_password2}</label>
                <input type="password" id="contact_password2" name="contact_password2" value="" />
            </p>
    
            <div id="pass-strength-result">{$labels.password_indicator}</div>
            <div class="indicator-hint">{$labels.password_hint}</div>
    
            <p class="send_password">
                <label for="send_password">>> {$labels.send_password} >> <input type="checkbox" {if $vals.send_password == 1 } checked {/if} name="user_data[send_password]" id="send_password" value="1" /> {$labels.send_password_desc}</label>
            </p>
    
            <div id="wpc_block_captcha">{if isset($labels.captcha)}{$labels.captcha}{/if}</div>
    
            <p class="btnAdd">
                <input type='submit' name='btnAdd' id="btnAdd" class='button-primary' value='{$labels.send_button}' />
            </p>
        </form>
    </div>
  • The topic ‘Joining two registration forms together’ is closed to new replies.