File: /var/www/html/wpprotonperinggit/wp-content/themes/voiture/widgets/private-message-form.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
extract( $args );
global $post;
if ( !empty($post->post_type) && $post->post_type == 'listing' ) {
$author_name = get_the_author_meta('display_name');
extract( $args );
extract( $instance );
echo trim($before_widget);
$title = !empty($instance['title']) ? sprintf($instance['title'], $author_name) : '';
$title = apply_filters('widget_title', $title);
if ( $title ) {
echo trim($before_title) . trim( $title ) . $after_title;
}
$rand_id = voiture_random_key();
?>
<div class="contact-form-agent">
<?php
if ( is_user_logged_in() ) {
?>
<form id="send-message-form" class="send-message-form form-theme" action="?" method="post">
<div class="form-group">
<input id="send-message-form-subject-<?php echo esc_attr($rand_id); ?>" type="text" class="form-control" name="subject" required="required">
<label for="send-message-form-subject-<?php echo esc_attr($rand_id); ?>" class="for-control"><?php esc_attr_e( 'Subject', 'voiture' ); ?></label>
</div><!-- /.form-group -->
<div class="form-group">
<textarea id="send-message-form-message-<?php echo esc_attr($rand_id); ?>" class="form-control" name="message" required="required"></textarea>
<label for="send-message-form-message-<?php echo esc_attr($rand_id); ?>" class="for-control"><?php esc_attr_e( 'Enter text here...', 'voiture' ); ?></label>
</div><!-- /.form-group -->
<?php wp_nonce_field( 'wp-private-message-send-message', 'wp-private-message-send-message-nonce' ); ?>
<input type="hidden" name="recipient" value="<?php echo esc_attr($user_id); ?>">
<input type="hidden" name="action" value="wp_private_message_send_message">
<button class="button btn btn-theme btn-block send-message-btn"><?php echo esc_html__( 'Send Message', 'voiture' ); ?></button>
</form>
<?php
} else {
$login_url = '';
if ( function_exists('wp_cardealer_get_option') ) {
$login_register_page_id = wp_cardealer_get_option('login_register_page_id');
$login_url = get_permalink( $login_register_page_id );
}
?>
<a href="<?php echo esc_url($login_url); ?>" class="login"><?php esc_html_e('Please login to send a private message', 'voiture'); ?></a>
<?php
}
?>
</div>
<?php echo trim($after_widget);
}