public function mo2f_register_user()
    {
        global $wpdb;
        global $current_user;
        get_currentuserinfo();
        if (mo_2factor_is_curl_installed() == 0) {
            ?>
			<p style="color:red;">(Warning: <a href="http://php.net/manual/en/curl.installation.php" target="_blank">PHP CURL extension</a> is not installed or disabled)</p>
		<?php 
        }
        $mo2f_active_tab = isset($_GET['mo2f_tab']) ? $_GET['mo2f_tab'] : '2factor_setup';
        ?>
		<div id="tab">
			<h2 class="nav-tab-wrapper">
				<a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=2factor_setup" class="nav-tab <?php 
        echo $mo2f_active_tab == '2factor_setup' ? 'nav-tab-active' : '';
        ?>
" id="mo2f_tab1"><?php 
        if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR' || get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION' || get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_PLUGIN_SETTINGS') {
            ?>
User Profile <?php 
        } else {
            ?>
 Account Setup <?php 
        }
        ?>
</a> 
				<a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure" class="nav-tab <?php 
        echo $mo2f_active_tab == 'mobile_configure' ? 'nav-tab-active' : '';
        ?>
" id="mo2f_tab2">Setup Two-Factor</a>
				
				<?php 
        if (get_option('mo2f_deviceid_enabled')) {
            ?>
				<!-- <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=advance_option" class="nav-tab <?php 
            //echo $mo2f_active_tab == 'advance_option' ? 'nav-tab-active' : '';
            ?>
" id="mo2f_tab5">Device Management</a> -->
				<?php 
        }
        ?>
				<a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo" class="nav-tab <?php 
        echo $mo2f_active_tab == 'mo2f_demo' ? 'nav-tab-active' : '';
        ?>
" id="mo2f_tab4">How It Works</a>
				<a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help" class="nav-tab <?php 
        echo $mo2f_active_tab == 'mo2f_help' ? 'nav-tab-active' : '';
        ?>
" id="mo2f_tab3">Help & Troubleshooting</a>
			</h2>
		</div>
		
		<div class="mo2f_container">
		<div id="messages"></div>
			<table style="width:100%;">
				<tr>
					<td style="width:60%;vertical-align:top;">
		<?php 
        if ($mo2f_active_tab == 'mobile_configure') {
            $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
            mo2f_select_2_factor_method($current_user, $mo2f_second_factor);
            ?>
				<script>
					jQuery(document).ready(function(){
						jQuery("#mo2f_support_table").hide();
					});
				</script>
			<?php 
        } else {
            if ($mo2f_active_tab == 'mo2f_demo') {
                unset($_SESSION['mo2f_google_auth']);
                unset($_SESSION['mo2f_mobile_support']);
                show_2_factor_login_demo($current_user);
            } else {
                if ($mo2f_active_tab == 'mo2f_help') {
                    unset($_SESSION['mo2f_google_auth']);
                    unset($_SESSION['mo2f_mobile_support']);
                    mo2f_show_help_and_troubleshooting($current_user);
                } else {
                    if (get_option('mo2f_deviceid_enabled') && $mo2f_active_tab == 'advance_option') {
                        unset($_SESSION['mo2f_google_auth']);
                        unset($_SESSION['mo2f_mobile_support']);
                        show_2_factor_advanced_options($current_user);
                        //Login Settings tab
                    } else {
                        unset($_SESSION['mo2f_google_auth']);
                        unset($_SESSION['mo2f_mobile_support']);
                        if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_OTP_DELIVERED_SUCCESS' || get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_OTP_DELIVERED_FAILURE') {
                            mo2f_show_user_otp_validation_page();
                        } else {
                            if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION') {
                                $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
                                mo2f_show_instruction_to_allusers($current_user, $mo2f_second_factor);
                            } else {
                                if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR') {
                                    mo2f_show_instruction_to_allusers($current_user, 'NONE');
                                } else {
                                    if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_PLUGIN_SETTINGS') {
                                        $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
                                        mo2f_show_instruction_to_allusers($current_user, $mo2f_second_factor);
                                    } else {
                                        show_user_welcome_page($current_user);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        ?>
					</td>
					<td style="vertical-align:top;padding-left:1%;" id="mo2f_support_table">
					</td>
				</tr>
			</table>
		</div>
		<?php 
    }
function mo_2_factor_register($current_user)
{
    if (mo_2factor_is_curl_installed() == 0) {
        ?>
			<p style="color:red;">(Warning: <a href="http://php.net/manual/en/curl.installation.php" target="_blank">PHP CURL extension</a> is not installed or disabled)</p>
		<?php 
    }
    $mo2f_active_tab = isset($_GET['mo2f_tab']) ? $_GET['mo2f_tab'] : '2factor_setup';
    ?>
		
		<div id="tab">
			<h2 class="nav-tab-wrapper">
				<a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=2factor_setup" class="nav-tab <?php 
    echo $mo2f_active_tab == '2factor_setup' ? 'nav-tab-active' : '';
    ?>
" id="mo2f_tab1">
				<?php 
    if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION' || get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_PLUGIN_SETTINGS') {
        ?>
User Profile <?php 
    } else {
        ?>
 Account Setup <?php 
    }
    ?>
</a> 
				<a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure" class="nav-tab <?php 
    echo $mo2f_active_tab == 'mobile_configure' ? 'nav-tab-active' : '';
    ?>
" id="mo2f_tab3">Setup Two-Factor</a>
				<a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_login" class="nav-tab <?php 
    echo $mo2f_active_tab == 'mo2f_login' ? 'nav-tab-active' : '';
    ?>
" id="mo2f_tab2">Login Settings</a>
				<a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=advance_option" class="nav-tab <?php 
    echo $mo2f_active_tab == 'advance_option' ? 'nav-tab-active' : '';
    ?>
" id="mo2f_tab2">Advanced Options</a>
				<a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_pricing" class="nav-tab <?php 
    echo $mo2f_active_tab == 'mo2f_pricing' ? 'nav-tab-active' : '';
    ?>
" id="mo2f_tab6">Licensing Plans</a>
				<a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo" class="nav-tab <?php 
    echo $mo2f_active_tab == 'mo2f_demo' ? 'nav-tab-active' : '';
    ?>
" id="mo2f_tab4">How It Works</a>
			    <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help" class="nav-tab <?php 
    echo $mo2f_active_tab == 'mo2f_help' ? 'nav-tab-active' : '';
    ?>
" id="mo2f_tab5">Help & Troubleshooting</a>
				
			</h2>
		</div>

		
		<div class="mo2f_container">
		<div id="messages"></div>
			<table style="width:100%;">
				<tr>
					<td style="width:60%;vertical-align:top;">
						<?php 
    /* to update the status of existing customers for adding their user registration status */
    if (get_option('mo_2factor_admin_registration_status') == 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' && get_option('mo2f_miniorange_admin') == $current_user->ID) {
        update_user_meta($current_user->ID, 'mo_2factor_user_registration_with_miniorange', 'SUCCESS');
    }
    /* ----------------------------------------- */
    if ($mo2f_active_tab == 'mobile_configure') {
        $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
        mo2f_select_2_factor_method($current_user, $mo2f_second_factor);
        //Configure 2-Factor tab
        ?>
									<script>
										jQuery(document).ready(function(){
											jQuery("#mo2f_support_table").hide();
										});
									</script>
								<?php 
    } else {
        if ($mo2f_active_tab == 'mo2f_help') {
            unset($_SESSION['mo2f_google_auth']);
            unset($_SESSION['mo2f_mobile_support']);
            mo2f_show_help_and_troubleshooting($current_user);
            //Help & Troubleshooting tab
        } else {
            if ($mo2f_active_tab == 'mo2f_demo') {
                unset($_SESSION['mo2f_google_auth']);
                unset($_SESSION['mo2f_mobile_support']);
                show_2_factor_login_demo($current_user);
            } else {
                if (current_user_can('manage_options') && $mo2f_active_tab == 'mo2f_login') {
                    unset($_SESSION['mo2f_google_auth']);
                    unset($_SESSION['mo2f_mobile_support']);
                    show_2_factor_login_settings($current_user);
                    //Login Settings tab
                } else {
                    if (current_user_can('manage_options') && $mo2f_active_tab == 'advance_option') {
                        unset($_SESSION['mo2f_google_auth']);
                        unset($_SESSION['mo2f_mobile_support']);
                        show_2_factor_advanced_options($current_user);
                        //Login Settings tab
                    } else {
                        if (current_user_can('manage_options') && $mo2f_active_tab == 'mo2f_pricing') {
                            unset($_SESSION['mo2f_google_auth']);
                            unset($_SESSION['mo2f_mobile_support']);
                            show_2_factor_pricing_page($current_user);
                            //Login Settings tab
                        } else {
                            unset($_SESSION['mo2f_google_auth']);
                            unset($_SESSION['mo2f_mobile_support']);
                            if (get_option('mo_2factor_admin_registration_status') == 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' && get_option('mo2f_miniorange_admin') != $current_user->ID) {
                                if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_OTP_DELIVERED_SUCCESS' || get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_OTP_DELIVERED_FAILURE') {
                                    mo2f_show_user_otp_validation_page();
                                    // OTP over email validation page
                                } else {
                                    if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION') {
                                        //displaying user profile
                                        $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
                                        mo2f_show_instruction_to_allusers($current_user, $mo2f_second_factor);
                                    } else {
                                        if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_PLUGIN_SETTINGS') {
                                            $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
                                            mo2f_show_instruction_to_allusers($current_user, $mo2f_second_factor);
                                            //displaying user profile
                                        } else {
                                            show_user_welcome_page($current_user);
                                            //Landing page for additional admin for registration
                                        }
                                    }
                                }
                            } else {
                                if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_OTP_DELIVERED_SUCCESS' || get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_OTP_DELIVERED_FAILURE') {
                                    mo2f_show_otp_validation_page($current_user);
                                    // OTP over email validation page for admin
                                } else {
                                    if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION') {
                                        //displaying user profile
                                        $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
                                        mo2f_show_instruction_to_allusers($current_user, $mo2f_second_factor);
                                    } else {
                                        if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_PLUGIN_SETTINGS') {
                                            $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
                                            mo2f_show_instruction_to_allusers($current_user, $mo2f_second_factor);
                                            //displaying user profile
                                        } else {
                                            if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_VERIFY_CUSTOMER') {
                                                mo2f_show_verify_password_page();
                                                //verify password page
                                            } else {
                                                if (!mo2f_is_customer_registered()) {
                                                    delete_option('password_mismatch');
                                                    mo2f_show_new_registration_page($current_user);
                                                    //new registration page
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    ?>
					</td>
					<td style="vertical-align:top;padding-left:1%;" id="mo2f_support_table">
						<?php 
    if ($mo2f_active_tab != 'mobile_configure') {
        echo mo2f_support();
    }
    ?>
	
					</td>
				</tr>
			</table>
		</div>
		<?php 
}