<?php 

function registration_cb() {
	$landing_page = ($option = get_option("landing_page")) ? $option : $landing_page;
	$registration_btn_text = ($option = get_option("registration_btn_text")) ? $option : "Create Profile <i class=\"fas fa-signup\"></i>";
	$option = get_option("home_url");
    $redirect = ($option && $option !== "") ? $option : $landing_page;
    if(isset($_GET['redirect'])) {
    	$temp_redirect = $_GET['redirect'];
        if($redirect === $landing_page) {
            $redirect .= ($_GET['redirect'] === "") ? "" : $_GET['redirect'];
            unset($_GET['redirect']);
            if (_count($_GET)) {
                $redirect .= "?".http_build_query($_GET);
            }
        } else {
            $redirect .= ($_GET['redirect'] === "") ? $landing_page : $_GET['redirect'];
            unset($_GET['redirect']);
            if (_count($_GET)) {
                $redirect .= "?".http_build_query($_GET);
            }
        }
        
    } else {
        if($redirect !== $landing_page) {
            $redirect .= $landing_page;
        }
    }

	?>
	<form class="registration" method="post" id="registration-form" action="app/includes/ajax.php" data-redirect="<?php echo $redirect; ?>" data-clearform="1" data-callback="redirectLogin">
		<?php do_action("registration"); ?>
		<div class="row">
			<div class="col-md-12">
				<?php 
		        	submit_btn('registration', apply_filters("registration_form_btn_text", $registration_btn_text));
		         ?>
		         <label class="pull-right">Already have an account? <a href="<?php echo LOGIN_PAGE; echo (isset($temp_redirect)) ? '?redirect='.$temp_redirect : ''; ?>">Login</a></label>
			</div>
		</div>
        
        
    </form>
	<?php
	global $post_meta;
	add_page_javascript('app/assets/js/page-scripts/submit.js');
	add_page_javascript('app/assets/js/page-scripts/js-functions.js');
}