Пример #1
0
    function ProjectTheme_do_register_scr()
    {
        global $wpdb, $wp_query, $current_theme_locale_name;
        if (!is_array($wp_query->query_vars)) {
            $wp_query->query_vars = array();
        }
        header('Content-Type: ' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset'));
        session_start();
        switch ($_REQUEST["action"]) {
            case 'register':
                require_once ABSPATH . WPINC . '/registration-functions.php';
                $user_login = sanitize_user(str_replace(" ", "", $_POST['user_login']));
                $user_email = trim($_POST['user_email']);
                $sanitized_user_login = $user_login;
                $errors = Project_register_new_user_sitemile($user_login, $user_email);
                if (!is_wp_error($errors)) {
                    $ok_reg = 1;
                }
                if (1 == $ok_reg) {
                    //continues after the break;
                    get_header();
                    global $current_theme_locale_name;
                    ?>
              <div class="page_heading_me">
                        <div class="page_heading_me_inner">
                            <div class="mm_inn"><?php 
                    printf(__("Registration Complete - %s", $current_theme_locale_name), get_bloginfo('name'));
                    ?>
   </div>
                  	            
                                        
                        </div>
                    
                    </div> 
        
        <div id="main_wrapper">
		<div id="main" class="wrapper"><div class="padd10">
				
				<div class="my_box3">
            	<div class="padd10">
            
            	 
							<p><?php 
                    printf(__('Username: %s', $current_theme_locale_name), "<strong>" . wp_specialchars($user_login) . "</strong>");
                    ?>
<br />
							<?php 
                    printf(__('Password: %s', $current_theme_locale_name), '<strong>' . __('emailed to you', $current_theme_locale_name) . '</strong>');
                    ?>
 <br />
							<?php 
                    printf(__('E-mail: %s', $current_theme_locale_name), "<strong>" . wp_specialchars($user_email) . "</strong>");
                    ?>
<br /><br />
							<?php 
                    _e("Please check your <strong>Junk Mail</strong> if your account information does not appear within 5 minutes.", $current_theme_locale_name);
                    ?>
                            </p>

							<p class="submit"><a href="wp-login.php"><?php 
                    _e('Login', $current_theme_locale_name);
                    ?>
 &raquo;</a></p>
						</div></div>
                        
                        
                        </div></div></div>
		<?php 
                    get_footer();
                    die;
                    break;
                }
                //continued from the error check above
            //continued from the error check above
            default:
                get_header();
                ?>
                
                <div class="page_heading_me">
                        <div class="page_heading_me_inner">
                            <div class="mm_inn"><?php 
                printf(__("Register - %s", $current_theme_locale_name), get_bloginfo('name'));
                ?>
   </div>
                  	            
                                        
                        </div>
                    
                    </div> 
<!-- ########## -->

<div id="main_wrapper">
		<div id="main" class="wrapper"><div class="padd10">
                
				
				<div class="my_box3">
            	<div class="padd10">
            
            	 
                <div class="box_content">                                          
						  
						  <?php 
                if (isset($errors) && isset($_POST['action'])) {
                    ?>
						  <div class="error">
							<ul>
							<?php 
                    $me = $errors->get_error_messages();
                    foreach ($me as $mm) {
                        echo "<li>" . $mm . "</li>";
                    }
                    ?>
							</ul>
						  </div>
						  <?php 
                }
                ?>
						  <div class="login-submit-form">
                          
                          
                          <form method="post" id="registerform" action="<?php 
                echo esc_url(site_url('wp-login.php?action=register', 'login_post'));
                ?>
">
						  <input type="hidden" name="action" value="register" />	
							
							<p>
                            <label for="register-username"><?php 
                _e('Username:'******'E-mail:', $current_theme_locale_name);
                ?>
</label>
							<input type="text" class="do_input" name="user_email" id="user_email" size="30" maxlength="100" value="<?php 
                echo wp_specialchars($user_email);
                ?>
" />
							</p>
							
                            <?php 
                $ProjectTheme_enable_2_user_tp = get_option('ProjectTheme_enable_2_user_tp');
                if ($ProjectTheme_enable_2_user_tp == "yes") {
                    $enbl = true;
                    $enbl = apply_filters('ProjectTheme_enbl_two_user_types_thing', $enbl);
                    if ($enbl) {
                        ?>
                           
                            
                            <p>							 
							<label for="register-email"><?php 
                        _e('User Type:', $current_theme_locale_name);
                        ?>
</label>
							<input type="radio" class="do_input" name="user_tp" id="user_tp" value="service_provider" checked="checked" /> <?php 
                        _e('Service Provider', $current_theme_locale_name);
                        ?>
<br/>
                            <input type="radio" class="do_input" name="user_tp" id="user_tp" value="business_owner" /> <?php 
                        _e('Service Contractor', $current_theme_locale_name);
                        ?>
<br/>
							</p>
                            
                            
                            
                            <?php 
                    }
                }
                ?>
                            
                           
							
                        
							<?php 
                do_action('register_form');
                ?>

							<p><label for="submitbtn">&nbsp;</label>
							<?php 
                _e('A password will be emailed to you.', $current_theme_locale_name);
                ?>
</p>
							

                          
							
						<p class="submit">
                        <label for="submitbtn">&nbsp;</label>
							 <input type="submit" class="submit_bottom" value="<?php 
                _e('Register', $current_theme_locale_name);
                ?>
" id="submits" name="submits" />
						</p>
                          
						  <ul id="logins">
							<li><a href="<?php 
                bloginfo('home');
                ?>
/" title="<?php 
                _e('Are you lost?', $current_theme_locale_name);
                ?>
"><?php 
                _e('Home', $current_theme_locale_name);
                ?>
</a></li>
							<li><a href="<?php 
                bloginfo('wpurl');
                ?>
/wp-login.php"><?php 
                _e('Login', $current_theme_locale_name);
                ?>
</a></li>
							<li><a href="<?php 
                bloginfo('wpurl');
                ?>
/wp-login.php?action=lostpassword" title="<?php 
                _e('Password Lost?', $current_theme_locale_name);
                ?>
"><?php 
                _e('Lost your password?', $current_theme_locale_name);
                ?>
</a></li>
						  </ul>
                          
                          </form>
						</div>
                        
                        
                        
                        </div>
                        </div>
                        </div>
                        
                        
                        
                        </div></div></div>
                        
                        
		<?php 
                get_footer();
                die;
                break;
            case 'disabled':
                get_header();
                ?>
        <div class="clear10"></div>	
				<div class="my_box3">
            	<div class="padd10">

        <div class="box_title"><?php 
                _e('Registration Disabled', $current_theme_locale_name);
                ?>
</div>
                <div class="box_content">
                                                  
							
							<p><?php 
                _e('User registration is currently not allowed.', $current_theme_locale_name);
                ?>
<br />
							<a href="<?php 
                echo get_settings('home');
                ?>
/" title="<?php 
                _e('Go back to the blog', $current_theme_locale_name);
                ?>
"><?php 
                _e('Home', $current_theme_locale_name);
                ?>
</a>
							</p>
						</div></div></div>
		<?php 
                get_footer();
                die;
                break;
        }
    }
Пример #2
0
    function ProjectTheme_do_register_scr()
    {
        global $wpdb, $wp_query, $current_theme_locale_name;
        if (!is_array($wp_query->query_vars)) {
            $wp_query->query_vars = array();
        }
        header('Content-Type: ' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset'));
        session_start();
        switch ($_REQUEST["action"]) {
            case 'register':
                require_once ABSPATH . WPINC . '/registration-functions.php';
                $user_login = sanitize_user(str_replace(" ", "", $_POST['user_login']));
                $user_email = trim($_POST['user_email']);
                $sanitized_user_login = $user_login;
                $errors = Project_register_new_user_sitemile($user_login, $user_email);
                if (!is_wp_error($errors)) {
                    $ok_reg = 1;
                }
                if (1 == $ok_reg) {
                    //continues after the break;
                    get_header();
                    global $current_theme_locale_name;
                    ?>
              <div class="page_heading_me">
                        <div class="page_heading_me_inner">
                            <div class="mm_inn"><?php 
                    printf(__("Registration Complete - %s", $current_theme_locale_name), get_bloginfo('name'));
                    ?>
   </div>
                  	            
                                        
                        </div>
                    
                    </div> 
        
        <div id="main_wrapper">
		<div id="main" class="wrapper"><div class="padd10">
				
				<div class="my_box3">
            	<div class="padd10">
            
            	 
							<p><?php 
                    printf(__('Username: %s', $current_theme_locale_name), "<strong>" . wp_specialchars($user_login) . "</strong>");
                    ?>
<br />
							<?php 
                    printf(__('Password: %s', $current_theme_locale_name), '<strong>' . __('emailed to you', $current_theme_locale_name) . '</strong>');
                    ?>
 <br />
							<?php 
                    printf(__('E-mail: %s', $current_theme_locale_name), "<strong>" . wp_specialchars($user_email) . "</strong>");
                    ?>
<br /><br />
							<?php 
                    _e("Please check your <strong>Junk Mail</strong> if your account information does not appear within 5 minutes.", $current_theme_locale_name);
                    ?>
                            </p>

							<p class="submit"><a href="wp-login.php"><?php 
                    _e('Login', $current_theme_locale_name);
                    ?>
 &raquo;</a></p>
						</div></div>
                        
                        
                        </div></div></div>
		<?php 
                    get_footer();
                    die;
                    break;
                }
                //continued from the error check above
            //continued from the error check above
            default:
                get_header();
                ?>
                
                <div class="page_heading_me">
                        <div class="page_heading_me_inner">
                            <div class="mm_inn"><?php 
                printf(__("Register - %s", $current_theme_locale_name), get_bloginfo('name'));
                ?>
   </div>
                  	            
                                        
                        </div>
                    
                    </div> 
<!-- ########## -->

<div id="main_wrapper">
		<div id="main" class="wrapper"><div class="padd10">
                
				
				<div class="my_box3">
            	<div class="padd10">
            
            	 
                <div class="box_content">                                          
						  
						  <?php 
                if (isset($errors) && isset($_POST['action'])) {
                    ?>
						  <div class="error">
							<ul>
							<?php 
                    $me = $errors->get_error_messages();
                    foreach ($me as $mm) {
                        echo "<li>" . $mm . "</li>";
                    }
                    ?>
							</ul>
						  </div>
						  <?php 
                }
                ?>
						  <div class="login-submit-form">
                          
                          
                          <form method="post" id="registerform" action="<?php 
                echo esc_url(site_url('wp-login.php?action=register', 'login_post'));
                ?>
">
						  <input type="hidden" name="action" value="register" />	
							
							<p>
                            <label for="register-username"><?php 
                _e('Username:'******'E-mail:', $current_theme_locale_name);
                ?>
</label>
							<input type="text" class="do_input" name="user_email" id="user_email" size="30" maxlength="100" value="<?php 
                echo wp_specialchars($user_email);
                ?>
" />
							<div id="error_email" class="error" style="display:none;">Maximum E-mail length is 100 characters.</div>
							</p>

							<script type="text/javascript">
							$(document).ready(function(){
								b=0;
								c=0;
								$('#user_login').keypress(function(){
									var a = $(this).val().length;
									
									if (a==20 && b==0){b=1;}
									if (a==20 && b==1){
										$('#error_username').show();
									}
									else{
										b=0;
										$('#error_username').hide();
									}
								});

								$('#user_email').keypress(function(){
									var a = $(this).val().length;
									if (a==100 && c==0){c=1;}
									if (a==100 && c==1){
										$('#error_email').show();
									}
									else{
										c=0;
										$('#error_email').hide();
									}
								});

							});
							</script>
							
                            <?php 
                $ProjectTheme_enable_2_user_tp = get_option('ProjectTheme_enable_2_user_tp');
                if ($ProjectTheme_enable_2_user_tp == "yes") {
                    $enbl = true;
                    $enbl = apply_filters('ProjectTheme_enbl_two_user_types_thing', $enbl);
                    if ($enbl) {
                        ?>
                           
                            
                            <p>							 
							<label for="register-email"><?php 
                        _e('User Type:', $current_theme_locale_name);
                        ?>
</label>
							<input type="radio" class="do_input" name="user_tp" id="user_tp" value="service_provider" checked="checked" /> <?php 
                        _e('QA Engineer', $current_theme_locale_name);
                        ?>
<br/>
                            <input type="radio" class="do_input" name="user_tp" id="user_tp" value="business_owner" /> <?php 
                        _e('Project Owner', $current_theme_locale_name);
                        ?>
<br/>
							</p>
                            
                            
                            
                            <?php 
                    }
                }
                ?>
                            
                           
							
                        
							<?php 
                do_action('register_form');
                ?>

							<p><label for="submitbtn">&nbsp;</label>
							<?php 
                _e('A password will be emailed to you.', $current_theme_locale_name);
                ?>
</p>
							

                          
							
						<p class="submit">
                        <label for="submitbtn">&nbsp;</label>
							 <input type="submit" class="submit_bottom" value="<?php 
                _e('Register', $current_theme_locale_name);
                ?>
" id="submits" name="submits" />
						</p>
                          
						  <ul id="logins">
							<li><a href="<?php 
                bloginfo('home');
                ?>
/" title="<?php 
                _e('Are you lost?', $current_theme_locale_name);
                ?>
"><?php 
                _e('Home', $current_theme_locale_name);
                ?>
</a></li>
							<li><a href="<?php 
                bloginfo('wpurl');
                ?>
/wp-login.php"><?php 
                _e('Login', $current_theme_locale_name);
                ?>
</a></li>
							<li><a href="<?php 
                bloginfo('wpurl');
                ?>
/wp-login.php?action=lostpassword" title="<?php 
                _e('Password Lost?', $current_theme_locale_name);
                ?>
"><?php 
                _e('Lost your password?', $current_theme_locale_name);
                ?>
</a></li>
						  </ul>
                          
                          </form>

                          <script type="text/javascript">
                          	$(function() {
                          	    // gather all inputs of selected types
                          	    var inputs = $('#user_tp, #user_email, #user_login, #log, #login_password, #rememberme, #submits, .green_btn'), inputTo;

                          	    // bind on keydown
                          	    inputs.on('keydown', function(e) {
                          	        
                          	        // if we pressed the tab
                          	        if (e.keyCode == 9 || e.which == 9) {
                          	        	
                          	            // prevent default tab action
                          	            e.preventDefault();

                          	            if (e.shiftKey) {
                          	                // get previous input based on the current input
                          	                inputTo = inputs.get(inputs.index(this) - 1);
                          	            } else {
                          	                // get next input based on the current input
                          	                inputTo = inputs.get(inputs.index(this) + 1);
                          	            }
                          	            
                          	            // move focus to inputTo, otherwise focus first input
                          	            if (inputTo) {
                          	                inputTo.focus();
                          	            } else {
                          	                inputs[0].focus();
                          	            }
                          	        }
                          	    });
                          	});
                          </script>
						</div>
                        
                        
                        
                        </div>
                        </div>
                        </div>
                        
                        
                        
                        </div></div></div>
                        
                        
		<?php 
                get_footer();
                die;
                break;
            case 'disabled':
                get_header();
                ?>
        <div class="clear10"></div>	
				<div class="my_box3">
            	<div class="padd10">

        <div class="box_title"><?php 
                _e('Registration Disabled', $current_theme_locale_name);
                ?>
</div>
                <div class="box_content">
                                                  
							
							<p><?php 
                _e('User registration is currently not allowed.', $current_theme_locale_name);
                ?>
<br />
							<a href="<?php 
                echo get_settings('home');
                ?>
/" title="<?php 
                _e('Go back to the blog', $current_theme_locale_name);
                ?>
"><?php 
                _e('Home', $current_theme_locale_name);
                ?>
</a>
							</p>
						</div></div></div>
		<?php 
                get_footer();
                die;
                break;
        }
    }