File: /var/www/html/wpprotonperinggit/wp-content/themes/voiture/widgets/listing-contact-form.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
extract( $args );
global $post;
if ( !empty($post->post_type) && $post->post_type == 'listing' ) {
$author_id = $post->post_author;
$author_email = get_the_author_meta('user_email');
$user = get_userdata( $author_id );
$a_title_html = $user->display_name;
$a_phone = get_user_meta($author_id, '_user_phone', true);
$a_phone = voiture_user_display_phone($a_phone, 'no-title', false);
$whatsapp = get_user_meta($author_id, '_user_whatsapp', true);
if ( ! empty( $author_email ) ) :
extract( $args );
extract( $instance );
echo trim($before_widget);
$title = !empty($instance['title']) ? $instance['title'] : '';
$title = apply_filters('widget_title', $title);
if ( $title ) {
echo trim($before_title) . trim( $title ) . $after_title;
}
$name = $email = $phone = '';
if ( is_user_logged_in() ) {
$current_user_id = get_current_user_id();
$userdata = get_userdata( $current_user_id );
$name = $userdata->display_name;
$email = $userdata->user_email;
$phone = get_user_meta($current_user_id, '_user_phone', true);
}
$rand_id = voiture_random_key();
?>
<div class="contact-form-agent">
<div class="agent-content-wrapper flex-middle">
<div class="agent-thumbnail">
<a href="<?php echo esc_url( get_author_posts_url( $author_id ) ); ?>">
<?php echo voiture_get_avatar($post->post_author, 180); ?>
</a>
</div>
<div class="agent-content">
<h3><a href="<?php echo esc_url( get_author_posts_url( $author_id ) ); ?>"><?php echo trim($a_title_html); ?></a></h3>
<?php if($a_phone){ ?>
<div class="flex-phone flex-middle"><i class="flaticon-phone-receiver-silhouette"></i><?php echo trim($a_phone); ?></div>
<?php } ?>
</div>
</div>
<form method="post" action="?" class="contact-form-wrapper form-theme">
<div class="form-group">
<input id="contact-form-name-<?php echo esc_attr($rand_id); ?>" type="text" placeholder="<?php esc_attr_e( 'Your Name', 'voiture' ); ?>" class="form-control" name="name" required="required" value="<?php echo esc_attr($name); ?>">
</div><!-- /.form-group -->
<div class="form-group">
<input id="contact-form-email-<?php echo esc_attr($rand_id); ?>" type="email" placeholder="<?php esc_attr_e( 'Email', 'voiture' ); ?>" class="form-control" name="email" required="required" value="<?php echo esc_attr($email); ?>">
</div><!-- /.form-group -->
<div class="form-group">
<input id="contact-form-phone-<?php echo esc_attr($rand_id); ?>" type="text" placeholder="<?php esc_attr_e( 'Phone', 'voiture' ); ?>" class="form-control style2" name="phone" required="required" value="<?php echo esc_attr($phone); ?>">
</div><!-- /.form-group -->
<div class="form-group">
<textarea id="contact-form-message-<?php echo esc_attr($rand_id); ?>" class="form-control" placeholder="<?php esc_attr_e( 'Message', 'voiture' ); ?>" name="message" required="required"></textarea>
</div><!-- /.form-group -->
<?php if ( WP_CarDealer_Recaptcha::is_recaptcha_enabled() ) { ?>
<div id="recaptcha-contact-form" class="ga-recaptcha" data-sitekey="<?php echo esc_attr(wp_cardealer_get_option( 'recaptcha_site_key' )); ?>"></div>
<?php } ?>
<?php
$page_id = wp_cardealer_get_option('terms_conditions_page_id');
if ( !empty($page_id) ) {
$page_id = WP_CarDealer_Mixes::get_lang_post_id($page_id);
$page_url = get_permalink($page_id);
?>
<div class="form-group">
<label for="register-terms-and-conditions">
<input type="checkbox" name="terms_and_conditions" value="on" id="register-terms-and-conditions" required>
<?php
echo sprintf(wp_kses(__('I have read and accept the <a href="%s">Terms and Privacy Policy</a>', 'voiture'), array('a' => array('href' => array())) ), esc_url($page_url));
?>
</label>
</div>
<?php } ?>
<input type="hidden" name="post_id" value="<?php echo esc_attr($post->ID); ?>">
<button class="button btn btn-second btn-block" name="contact-form"><?php echo esc_html__( 'Send Message', 'voiture' ); ?></button>
<!-- whatsapp -->
<?php
if ( $whatsapp ) {
?>
<a class="btn btn-green btn-whatsapp" href="https://api.whatsapp.com/send?phone=<?php echo esc_attr($whatsapp); ?>&text=Hello" target="_blank"><i class="pre flaticon-whatsapp"></i><?php esc_html_e('Whatsapp', 'voiture'); ?></a>
<?php
}
?>
</form>
<?php do_action('wp-cardealer-single-listing-contact-form', $post, $author_id); ?>
</div>
<?php echo trim($after_widget);
endif;
}