login-page.php 3.11 KB
<?php
/*
 * Template Name: Login Page
 */
?>

<?php get_header();?>
<div id="page-content">
    <div id="login-wrap">
        <div id="container">
            <?php if (is_user_logged_in()):
?>
<script>window.location.replace("<?php echo site_url(); ?>");</script>
                <?php global $current_user;
get_currentuserinfo();
?>
                <div class="siblings mobile-hide">
                    <?php
if ($post->post_parent) {
    $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=" . $post->post_parent . "&echo=0");
    $titlenamer = get_the_title($post->post_parent);
} else {
    $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=" . $post->ID . "&echo=0");
    $titlenamer = get_the_title($post->ID);
}
if ($children) {?>
                        <ul>
                            <li class="<?php echo $post->post_parent ? '' : 'current_page_item'; ?>"><a href="<?php echo get_permalink($post->post_parent); ?>"><?php echo $titlenamer; ?></a></li>
                            <?php echo $children; ?>
                        </ul>
                    <?php }?>
                </div>
                <div class="siblings mobile-show">
                    <?php
if ($post->post_parent) {
    $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=" . $post->post_parent . "&echo=0");
    $titlenamer = get_the_title($post->post_parent);
} else {
    $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=" . $post->ID . "&echo=0");
    $titlenamer = get_the_title($post->ID);
}
if ($children) {?>
                        <ul>
                            <li class="<?php echo $post->post_parent ? '' : 'current_page_item'; ?>"><a href="<?php echo get_permalink($post->post_parent); ?>"><?php echo $titlenamer; ?></a></li>
                            <?php echo $children; ?>
                        </ul>
                    <?php }?>
                </div>
                <h2>Welcome <?php echo is_super_admin() ? 'Administrator' : $current_user->user_firstname . ' ' . $current_user->user_lastname; ?></h2>
                <p><a href="<?php echo wp_logout_url(home_url()); ?>" title="Logout">>> Member Logout</a></p>
            <?php else: ?>
                <h2>Broker Login</h2>
                <?php $args = array('redirect' => site_url());

if (isset($_GET['action'])): ?>
                    <div class="success">
                        <p>
                            Your password has been reset. Please check your email for your new password.
                        </p>
                    </div>
                <?php
endif;

if (isset($_GET['login']) && $_GET['login'] == 'failed_empty') {
    ?>
                    <div id="login-error">
                        <p>Login failed: You have entered an incorrect username or password. Please try again.</p>
                    </div>
                <?php
}
wp_login_form($args);

?>
                <br />
                <a style="margin-left:18px;" href="https://thecommonwell.ca/lost-password/" title="Password Lost and Found">Lost your password</a>
            <?php endif;?>
        </div>
    </div>
</div>
<?php get_footer();?>