<?php
/**
 * @package WordPress
 * @subpackage Campoal
 */

global $campoal_options;

// Check user is logged in and redirect to user page
$login_referer = isset($_GET['referer']) ? $_GET['referer'] : '';
$action = isset($_GET['action']) ? $_GET['action'] : 'signin';

$login_page = isset($campoal_options['conikal_page_login_field']) ? $campoal_options['conikal_page_login_field'] : 0;
$login_page = get_permalink($login_page);
$login_page_link = $login_page ? $login_page : '';
$signin_link = $login_page ? add_query_arg(array('action' => 'signin', 'referer' => $login_referer), $login_page_link) : '';
$signup_link = $login_page ? add_query_arg(array('action' => 'signup', 'referer' => $login_referer), $login_page_link) : '';
?>

<div class="ui basic center aligned segment">
    <?php if ($action == 'signup') : ?>
    <?php esc_html_e('You already have an account. Please ', 'campoal') ?>
    <a href="<?php echo esc_url($signin_link) ?>">
        <u><?php esc_html_e('login now!', 'campoal') ?></u>
    </a>
    <?php elseif ($action == 'signin') : ?>
    <?php esc_html_e('Do not have an account? Please ', 'campoal') ?>
    <a href="<?php echo esc_url($signup_link) ?>">
        <u><?php esc_html_e('register new account!', 'campoal') ?></u>
    </a>
    <?php endif; ?>
</div>