<?php
if ( !defined( 'ABSPATH' ) ) {
    exit;
}
$options = get_option( 'bwd_userfronted_options' );
if ( !current_user_can( 'cv_editor' ) ) {
    $show_login_form = apply_filters( 'bwdcv_show_login_form', true );
    if($show_login_form) {
        echo '<div class="bwd-tab-content">';
            echo '<div id="tab-1" class="bwd-custom-login-form">';
                if ( is_user_logged_in() ) {
                    echo '<p>' . esc_html__( 'You are already logged in.', 'cv-builder' ) . '</p>';
                    echo '<a href="' . wp_logout_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ) . '" class="btn btn-secondary">' . esc_html__( 'Log Out', 'cv-builder' ) . '</a>';
                } else {
                    $redirect_url = get_permalink($options['dashboard_page']);
                    echo woocommerce_login_form(array(
                        'redirect' => $redirect_url,
                    ));
                }
                echo '<a href="'.esc_url(get_permalink($options['registration_page'])).'" class="bwdcv-reg-log-extra">Register</a>';
                echo $this->display_social_login_btn();
            echo '</div>';
        echo '</div>';
    }
} else {
    ?>
    <div class="bwd-custom-registration-form bwdcv-login-user-guid bwdcv-already-loged-in">
        <p><?php esc_html_e( 'You are already logged in.', 'cv-builder' ); ?></p>
        <a href="<?php echo esc_url(get_permalink($options['dashboard_page'])); ?>" class="btn btn-primary bwdcv-my-account"><?php esc_html_e( 'CV Dashboard', 'cv-builder' ); ?></a>
        <a href="<?php echo wp_logout_url(home_url()); ?>" class="btn btn-secondary bwdcv-log-out"><?php esc_html_e( 'Log Out', 'cv-builder' ); ?></a>
    </div>
    <?php
}
