Created
September 23, 2024 14:00
-
-
Save jmabbas/57d30772cc48002ddc416c6ac1e06a20 to your computer and use it in GitHub Desktop.
Finder - Login singup popup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function finder_header_user_signup_form() { | |
if ( ! finder_is_hivepress_activated() ) { | |
return; | |
} | |
$is_dark_header = finder_is_header_navbar_dark(); | |
$default = apply_filters( 'finder_default_signup_title', 'Join Finder.<br>Get premium benefits:' ); | |
$signup_title = get_theme_mod( 'finder_signup_title', $default ); | |
$signup_image = get_theme_mod( 'finder_signup_image_option' ); | |
$user_signup_form_args = array( | |
'button' => array( | |
'label' => esc_html__( 'Sign up', 'finder' ), | |
'attributes' => array( | |
'class' => array( 'btn', 'btn-primary', 'btn-lg', 'w-100', 'mt-2' ), | |
), | |
), | |
'fields' => array( | |
'username' => array( | |
'placeholder' => esc_html__( 'Enter your full name', 'finder' ), | |
'attributes' => array( | |
'class' => array( 'mb-4' ), | |
), | |
), | |
'email' => array( | |
'placeholder' => esc_html__( 'Enter your email', 'finder' ), | |
), | |
'password' => array( | |
'placeholder' => esc_html__( 'Enter your password min 8 char', 'finder' ), | |
), | |
), | |
); | |
$user_signup_form = new User_Register( $user_signup_form_args ); | |
$features_str = get_theme_mod( 'finder_header_popup_signup_form_features', esc_html__( "Add and promote your listings\nEasily manage your wishlist\nLeave reviews", 'finder' ) ); | |
$features = explode( "\n", $features_str ); | |
$count = 0; | |
foreach ( $features as $feature ) { | |
if ( empty( trim( $feature ) ) ) { | |
continue; | |
} | |
$count ++; | |
} | |
?> | |
<div class="modal fade" id="user_signup_modal" tabindex="-1" aria-hidden="true"> | |
<div class="modal-dialog modal-lg modal-dialog-centered p-2 my-0 mx-auto" style="max-width: 950px;"> | |
<div class="modal-content<?php echo esc_attr( $is_dark_header ? ' bg-dark border-light' : '' ); ?>"> | |
<div class="modal-body px-0 py-2 py-sm-0"> | |
<button class="btn-close position-absolute top-0 end-0 mt-3 me-3<?php echo esc_attr( $is_dark_header ? ' btn-close-white' : '' ); ?>" type="button" data-bs-dismiss="modal"></button> | |
<div class="row mx-0 align-items-center"> | |
<div class="col-md-6 border-end-md p-4 p-sm-5<?php echo esc_attr( $is_dark_header ? ' border-light' : '' ); ?>"> | |
<?php if ( ! empty( $signup_title ) ) : ?> | |
<h2 class="finder-signup-title h3 mb-4 mb-sm-5<?php echo esc_attr( $is_dark_header ? ' text-light' : '' ); ?>"><?php echo wp_kses_post( $signup_title ); ?></h2> | |
<?php endif; ?> | |
<?php if ( 0 < $count ) : ?> | |
<ul class="list-unstyled mb-4 mb-sm-5"> | |
<?php foreach ( $features as $key => $feature ) : ?> | |
<li class="d-flex mb-<?php echo esc_attr( $count === $key + 1 ? '0' : '2' ); ?>"> | |
<i class="fi-check-circle text-primary mt-1 me-2"></i> | |
<span class="list-text<?php echo esc_attr( $is_dark_header ? ' text-light' : '' ); ?>"><?php echo esc_html( $feature ); ?></span> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
<?php endif; ?> | |
<?php if ( ! empty( $signup_image ) ) : ?> | |
<img class="d-block mx-auto" src="<?php echo esc_url( wp_get_attachment_url( $signup_image ) ); ?>" alt="<?php esc_attr_e( 'Illustartion', 'finder' ); ?>"> | |
<?php endif; ?> | |
<div class="mt-sm-4 pt-md-3<?php echo esc_attr( $is_dark_header ? ' text-light' : '' ); ?>"> | |
<?php | |
printf( | |
'%1$s <a href="#user_login_modal" class="signin-link%2$s" data-bs-toggle="modal" data-bs-dismiss="modal">%3$s</a>', | |
esc_html__( 'Already have an account?', 'finder' ), | |
esc_attr( $is_dark_header ? ' text-light' : '' ), | |
esc_html__( 'Sign in', 'finder' ) | |
); | |
?> | |
</div> | |
</div> | |
<div class="col-md-6 px-4 pt-2 pb-4 px-sm-5 pb-sm-5 pt-md-5"> | |
<div class="finder-hp-singup-popup-form<?php echo esc_attr( $is_dark_header ? ' finder-form-dark' : '' ); ?>"> | |
<?php echo wp_kses( $user_signup_form->render(), 'login_form' ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment