PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.8.1
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.8.1
8.8.1 8.8.0 8.7.9 8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 All 537 releases
← All changes | includes/chat-sessions/reports/view/partials/view-single-chat.php +194 -220 8.6.2 → 8.8.1 View file →
@@ -1,220 +1,194 @@
1 -<?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?>
2 -<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
3 -
4 -<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" integrity="sha384-4LISF5TTJX/fLmGSxO53rV4miRxdg84mZsxmO8Rx5jGtp/LbrixFETvWa5a6sESd" crossorigin="anonymous">
5 -
6 -<link href="<?php echo esc_url( QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/reports/view/assets/style.css' ); ?>" rel="stylesheet">
7 -
8 -<style>
9 - .wp-chatbot-messages-wrapper ul:first-child li{
10 - border-color: #41464b;
11 - background-color: #e2e3e5;
12 - padding: 10px;
13 - font-weight: bold;
14 - }
15 -
16 - .wp-chatbot-messages-container{
17 - padding: 10px;
18 - }
19 -
20 - .wp-chatbot-msg, .wp-chatbot-paragraph{
21 - text-align: justify !important;
22 - }
23 -
24 - .single-chat-container-wrapper{
25 - background-color: #fff;
26 - border-left: 3px solid #0073aa;
27 - margin-top: 20px;
28 - padding: 25px;
29 - }
30 - .forward-session-wrapper {
31 - display: flex;
32 - align-items: center;
33 - }
34 -
35 - .forward-session-wrapper span.btn.btn-secondary.forward_session {
36 - min-width: 220px;
37 - border-radius: 0 6px 6px 0;
38 - padding: 8px 0;
39 - }
40 - ul.wp-chatbot-messages-container > li .wp-chatbot-avatar, .wp-chatbot-agent-profile .wp-chatbot-widget-avatar,
41 - ul.wp-chatbot-messages-container > li.wp-chatbot-msg .wp-chatbot-avatar, .wp-chatbot-agent-profile .wp-chatbot-widget-avatar {
42 - width: auto !important;
43 - height: auto !important;
44 - position: relative;
45 - overflow: unset;
46 - }
47 -
48 - .forward-session-wrapper input#details_session_email {
49 - border-radius: 6px 0 0 6px;
50 - padding: 2px 12px;
51 - }
52 -
53 - .forward-session-wrapper input#details_session_email:focus {
54 - outline: none;
55 - box-shadow: none
56 - }
57 -
58 - /* Make all font sizes in the single chat session view the same */
59 - .qcld_session_history_result,
60 - .qcld_session_history_result table,
61 - .qcld_session_history_result table th,
62 - .qcld_session_history_result table td,
63 - .single-chat-container-wrapper,
64 - .single-chat-container-wrapper h3,
65 - .single-chat-container-wrapper p,
66 - .single-chat-container-wrapper span,
67 - .single-chat-container-wrapper div,
68 - .single-chat-container-wrapper li,
69 - .single-chat-container-wrapper input,
70 - .single-chat-container-wrapper button,
71 - .single-chat-container-wrapper a,
72 - .wp-chatbot-messages-wrapper,
73 - .wp-chatbot-messages-wrapper * {
74 - font-size: 15px !important;
75 - }
76 -</style>
77 -
78 -<?php
79 -
80 - global $wpdb;
81 -
82 - $userid = absint( $_GET['userid'] );
83 -
84 - $userinfo = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM %i WHERE id = %d', $tableuser, $userid ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
85 -
86 - $delurl = admin_url( 'admin.php?page=wbcs-botsessions-page&userid=' . $userinfo->id . '&act=delete' );
87 -
88 - $export = admin_url( 'admin-post.php?action=wpbot_conversations.csv&user_id=' . $userid );
89 -
90 -?>
91 - <div class="sld_menu_title qcld_session_history_result" style="text-align: left;">
92 - <table class="table table-bordered">
93 - <tbody>
94 - <tr>
95 - <th><?php echo esc_html( 'Session ID' ); ?></th>
96 - <td>
97 - <?php echo ( $userinfo->session_id != '' ) ? esc_html( $userinfo->session_id ) : '---'; ?>
98 - </td>
99 - </tr>
100 - <tr>
101 - <th><?php echo esc_html( 'User Name' ); ?></th>
102 - <td>
103 - <?php echo esc_html( $userinfo->name ); ?>
104 - </td>
105 - </tr>
106 - <tr>
107 - <th><?php echo esc_html( 'User Email' ); ?></th>
108 - <td>
109 - <?php echo ( $userinfo->email != '' ) ? esc_html( $userinfo->email ) : '---'; ?>
110 - </td>
111 - </tr>
112 - <tr>
113 - <th><?php echo esc_html( 'Phone Number' ); ?></th>
114 - <td>
115 - <?php echo ( $userinfo->phone != '' ) ? esc_html( $userinfo->phone ) : '---'; ?>
116 - </td>
117 - </tr>
118 - <tr>
119 - <th>
120 - <?php echo esc_html( 'Date and Time' ); ?>
121 - </th>
122 - <td>
123 - <?php echo esc_html( date( 'M d, Y h:i:s A', strtotime( $userinfo->date ) ) ); ?>
124 - </td>
125 - </tr>
126 - <tr>
127 - <th>Action Buttons</th>
128 - <td>
129 - <a href="<?php echo esc_url( $delurl ); ?>" class="btn btn-primary" onclick="return confirm('are you sure?')">
130 - <i class="bi bi-trash me-1"></i> Delete
131 - </a>
132 -
133 - <a href="<?php echo esc_url( $export ); ?>" class="btn btn-primary">
134 - <i class="bi bi-filetype-csv me-1"></i> Export
135 - </a>
136 -
137 - <a href="<?php echo esc_url( admin_url( 'admin.php?page=wbcs-botsessions-page' ) ); ?>" class="btn btn-secondary">
138 - <i class="bi bi-gear-wide-connected me-1"></i> Conversation List
139 - </a>
140 -
141 - </td>
142 - </tr>
143 - </tbody>
144 - </table>
145 - </div>
146 -
147 - <?php
148 -
149 - $result = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM %i WHERE user_id = %d', $tableconversation, $userid ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
150 -
151 - if ( ! empty( $result ) ) :
152 -
153 - $qcld_wb_chatbot_theme = get_option( 'qcld_wb_chatbot_theme' );
154 -
155 - if ( file_exists( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/style.css' ) ) {
156 - wp_register_style( 'qcld-wp-chatbot-style', QCLD_wpCHATBOT_PLUGIN_URL . '/templates/' . $qcld_wb_chatbot_theme . '/style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' );
157 - wp_enqueue_style( 'qcld-wp-chatbot-style' );
158 - }
159 -
160 - wp_register_style( 'qcld-wp-chatbot-history-style', QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/css/history-style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' );
161 - wp_enqueue_style( 'qcld-wp-chatbot-history-style' );
162 - wp_enqueue_style( 'qcld-wp-chatbot-jquery-ui' );
163 - wp_register_style( 'qcld-wp-chatbot-jquery-ui', QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/css/jqueryui.css', '', '', 'screen' );
164 - wp_register_style( 'qcld-wp-chatbot-common-style', QCLD_wpCHATBOT_PLUGIN_URL . '/css/common-style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' );
165 - wp_enqueue_style( 'qcld-wp-chatbot-common-style' );
166 -
167 - ?>
168 - <div class="single-chat-container-wrapper">
169 - <div class="container-fluid">
170 - <div class="row">
171 - <div class="col-md-10 text-left">
172 - <h3 class="mb-3">Chat Messages</h3>
173 - <div class="wp-chatbot-messages-wrapper">
174 - <?php
175 - $allowed_html = array_merge(
176 - wp_kses_allowed_html( 'post' ),
177 - array(
178 - 'div' => array( 'class' => true, 'id' => true, 'style' => true, 'data-*' => true ),
179 - 'span' => array( 'class' => true, 'id' => true, 'style' => true, 'data-*' => true ),
180 - 'ul' => array( 'class' => true ),
181 - 'li' => array( 'class' => true ),
182 - 'img' => array( 'src' => true, 'alt' => true, 'class' => true, 'style' => true ),
183 - )
184 - );
185 - echo wp_kses( htmlspecialchars_decode( $result->conversation ), $allowed_html );
186 - ?>
187 - <?php if ( ! empty( $userinfo->email ) ) : ?>
188 - <div class="email-reply-container mt-4 mb-4 p-3 border rounded bg-light">
189 - <h4 class="mt-0 mb-3">Reply via Email to: <strong><?php echo esc_html( $userinfo->email ); ?></strong></h4>
190 - <div class="form-group mb-3">
191 - <label for="reply_subject" class="form-label fw-bold">Subject</label>
192 - <input type="text" id="reply_subject" class="form-control" value="Reply to your chat session">
193 - </div>
194 - <div class="form-group mb-3">
195 - <label for="reply_message" class="form-label fw-bold">Message</label>
196 - <textarea id="reply_message" class="form-control" rows="4" placeholder="Type your reply here..."></textarea>
197 - </div>
198 - <button type="button" class="btn btn-primary" id="btn_send_reply_email" data-email="<?php echo esc_attr( $userinfo->email ); ?>">Send Reply</button>
199 - </div>
200 - <?php endif; ?>
201 - <div class="forward-session-wrapper">
202 - <input type="hidden" id="details_session_id" value="<?php echo esc_attr( $userinfo->session_id ); ?>">
203 - <input type="email" id="details_session_email" class="form-control" placeholder="<?php esc_attr_e( 'Enter email to forward session details', 'chatbot' ); ?>">
204 - <span class="btn btn-secondary forward_session"><?php echo esc_html( 'Forward Session' ); ?></span>
205 - </div>
206 - </div>
207 - </div>
208 -
209 - </div>
210 - </div>
211 - </div>
212 -
213 - <br>
214 -
215 - <a href="<?php echo esc_url( admin_url( 'admin.php?page=wbcs-botsessions-page' ) ); ?>" class="btn btn-primary">
216 - <i class="bi bi-gear-wide-connected me-1"></i> Conversation List
217 - </a>
218 - <?php
219 -
220 - endif;
1 +<?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?>
2 +
3 +<?php
4 + global $wpdb;
5 +
6 + $tableuser = $wpdb->prefix . 'wpbot_user';
7 + $tableconversation = $wpdb->prefix . 'wpbot_conversation';
8 + $table_user_sql = '`' . esc_sql( $tableuser ) . '`';
9 + $table_conv_sql = '`' . esc_sql( $tableconversation ) . '`';
10 + $userid = isset( $_GET['userid'] ) ? absint( wp_unslash( $_GET['userid'] ) ) : 0; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
11 +
12 + $userinfo = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$table_user_sql} WHERE id = %d", $userid ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
13 +
14 + $delurl = wp_nonce_url( admin_url( 'admin.php?page=wbcs-botsessions-page&userid=' . $userinfo->id . '&act=delete' ), 'wpcs_delete_session_' . $userinfo->id );
15 +
16 + $export = wp_nonce_url( admin_url( 'admin-post.php?action=wpbot_conversations.csv&user_id=' . $userid ), 'wpbot_conversations_csv' );
17 +
18 + wp_register_style( 'qcld-wp-chatbot-history-style', QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/css/history-style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' );
19 + wp_enqueue_style( 'qcld-wp-chatbot-history-style' );
20 +?>
21 +
22 +<div class="wpbot-session-details-page">
23 + <div class="sld_menu_title qcld_session_history_result wpbot-session-meta-card">
24 + <div class="wpbot-session-meta-card__header">
25 + <h2><?php echo esc_html__( 'Session Details', 'chatbot' ); ?></h2>
26 + <div class="wpbot-session-meta-card__actions">
27 + <a href="<?php echo esc_url( $delurl ); ?>" class="btn btn-danger" onclick="return confirm('Are you sure?')">
28 + <?php echo esc_html__( 'Delete', 'chatbot' ); ?>
29 + </a>
30 + <a href="<?php echo esc_url( $export ); ?>" class="btn btn-primary">
31 + <?php echo esc_html__( 'Export', 'chatbot' ); ?>
32 + </a>
33 + </div>
34 + </div>
35 +
36 + <div class="wpbot-session-meta-grid">
37 + <div class="wpbot-session-meta-item">
38 + <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'Session ID', 'chatbot' ); ?></span>
39 + <span class="wpbot-session-meta-item__value"><?php echo ( $userinfo->session_id != '' ) ? esc_html( $userinfo->session_id ) : '---'; ?></span>
40 + </div>
41 + <div class="wpbot-session-meta-item">
42 + <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'User Name', 'chatbot' ); ?></span>
43 + <span class="wpbot-session-meta-item__value"><?php echo esc_html( $userinfo->name ? $userinfo->name : '---' ); ?></span>
44 + </div>
45 + <div class="wpbot-session-meta-item">
46 + <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'User Email', 'chatbot' ); ?></span>
47 + <span class="wpbot-session-meta-item__value"><?php echo ( $userinfo->email != '' ) ? esc_html( $userinfo->email ) : '---'; ?></span>
48 + </div>
49 + <div class="wpbot-session-meta-item">
50 + <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'Phone Number', 'chatbot' ); ?></span>
51 + <span class="wpbot-session-meta-item__value"><?php echo ( $userinfo->phone != '' ) ? esc_html( $userinfo->phone ) : '---'; ?></span>
52 + </div>
53 + <div class="wpbot-session-meta-item">
54 + <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'Date and Time', 'chatbot' ); ?></span>
55 + <span class="wpbot-session-meta-item__value"><?php echo esc_html( gmdate( 'M d, Y h:i:s A', strtotime( $userinfo->date ) ) ); ?></span>
56 + </div>
57 + </div>
58 + </div>
59 +
60 + <?php
61 + $result = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$table_conv_sql} WHERE user_id = %d", $userid ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
62 +
63 + if ( ! empty( $result ) ) :
64 +
65 + $qcld_wb_chatbot_theme = get_option( 'qcld_wb_chatbot_theme' );
66 +
67 + if ( file_exists( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/style.css' ) ) {
68 + wp_register_style( 'qcld-wp-chatbot-style', QCLD_wpCHATBOT_PLUGIN_URL . '/templates/' . $qcld_wb_chatbot_theme . '/style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' );
69 + wp_enqueue_style( 'qcld-wp-chatbot-style' );
70 + }
71 +
72 + wp_enqueue_style( 'qcld-wp-chatbot-jquery-ui' );
73 + wp_register_style( 'qcld-wp-chatbot-jquery-ui', QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/css/jqueryui.css', '', '', 'screen' );
74 + wp_register_style( 'qcld-wp-chatbot-common-style', QCLD_wpCHATBOT_PLUGIN_URL . '/css/common-style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' );
75 + wp_enqueue_style( 'qcld-wp-chatbot-common-style' );
76 + ?>
77 +
78 + <div class="single-chat-container-wrapper wpbot-session-chat-card">
79 + <div class="wpbot-session-chat-card__header">
80 + <h3><?php echo esc_html__( 'Chat Messages', 'chatbot' ); ?></h3>
81 + <a href="<?php echo esc_url( admin_url( 'admin.php?page=wbcs-botsessions-page' ) ); ?>" class="btn btn-primary wpbot-session-back-btn">
82 + <?php echo esc_html__( 'Conversation List', 'chatbot' ); ?>
83 + </a>
84 + </div>
85 + <div class="wp-chatbot-messages-wrapper">
86 + <?php
87 + $allowed_html = array_merge(
88 + wp_kses_allowed_html( 'post' ),
89 + array(
90 + 'div' => array(
91 + 'class' => true,
92 + 'id' => true,
93 + 'style' => true,
94 + 'data-*' => true,
95 + ),
96 + 'span' => array(
97 + 'class' => true,
98 + 'id' => true,
99 + 'style' => true,
100 + 'data-*' => true,
101 + ),
102 + 'ul' => array( 'class' => true ),
103 + 'li' => array( 'class' => true ),
104 + 'img' => array(
105 + 'src' => true,
106 + 'alt' => true,
107 + 'class' => true,
108 + 'style' => true,
109 + ),
110 + )
111 + );
112 + echo wp_kses( htmlspecialchars_decode( $result->conversation ), $allowed_html );
113 + ?>
114 + </div>
115 + </div>
116 +
117 + <button type="button" class="wpbot-reply-fab" id="wpbot_reply_fab" aria-expanded="false" aria-controls="wpbot_reply_panel">
118 +
119 + <span><?php echo esc_html__( 'Reply via Email', 'chatbot' ); ?></span>
120 + </button>
121 +
122 + <div class="wpbot-reply-panel" id="wpbot_reply_panel" hidden>
123 + <div class="wpbot-reply-panel__header">
124 + <h4><?php echo esc_html__( 'Reply via Email', 'chatbot' ); ?></h4>
125 + <button type="button" class="wpbot-reply-panel__close" id="wpbot_reply_panel_close" aria-label="<?php esc_attr_e( 'Close', 'chatbot' ); ?>">&times;</button>
126 + </div>
127 + <div class="wpbot-reply-panel__body">
128 + <?php if ( ! empty( $userinfo->email ) ) : ?>
129 + <div class="email-reply-container">
130 + <p class="wpbot-reply-panel__to"><?php echo esc_html__( 'To:', 'chatbot' ); ?> <strong><?php echo esc_html( $userinfo->email ); ?></strong></p>
131 + <div class="form-group mb-3">
132 + <label for="reply_subject" class="form-label"><?php echo esc_html__( 'Subject', 'chatbot' ); ?></label>
133 + <input type="text" id="reply_subject" class="form-control" placeholder="<?php esc_attr_e( 'Reply to your chat session', 'chatbot' ); ?>">
134 + </div>
135 + <div class="form-group mb-3">
136 + <label for="reply_message" class="form-label"><?php echo esc_html__( 'Message', 'chatbot' ); ?></label>
137 + <textarea id="reply_message" class="form-control" rows="4" placeholder="<?php esc_attr_e( 'Type your reply here...', 'chatbot' ); ?>"></textarea>
138 + </div>
139 + <button type="button" class="btn btn-primary" id="btn_send_reply_email" data-email="<?php echo esc_attr( $userinfo->email ); ?>"><?php echo esc_html__( 'Send Reply', 'chatbot' ); ?></button>
140 + </div>
141 + <?php else : ?>
142 + <p class="wpbot-reply-panel__warning"><?php echo esc_html__( 'No user email available for this session.', 'chatbot' ); ?></p>
143 + <?php endif; ?>
144 + <div class="forward-session-wrapper">
145 + <input type="hidden" id="details_session_id" value="<?php echo esc_attr( $userinfo->session_id ); ?>">
146 + <input type="email" id="details_session_email" class="form-control" placeholder="<?php esc_attr_e( 'Enter email to forward session details', 'chatbot' ); ?>">
147 + <span class="btn btn-secondary forward_session"><?php echo esc_html__( 'Forward Session', 'chatbot' ); ?></span>
148 + </div>
149 + </div>
150 + </div>
151 +
152 + <script>
153 + (function () {
154 + var fab = document.getElementById('wpbot_reply_fab');
155 + var panel = document.getElementById('wpbot_reply_panel');
156 + var closeBtn = document.getElementById('wpbot_reply_panel_close');
157 + if (!fab || !panel) {
158 + return;
159 + }
160 + function openPanel() {
161 + panel.hidden = false;
162 + panel.classList.add('is-open');
163 + fab.setAttribute('aria-expanded', 'true');
164 + fab.classList.add('is-active');
165 + }
166 + function closePanel() {
167 + panel.classList.remove('is-open');
168 + fab.setAttribute('aria-expanded', 'false');
169 + fab.classList.remove('is-active');
170 + window.setTimeout(function () {
171 + if (!panel.classList.contains('is-open')) {
172 + panel.hidden = true;
173 + }
174 + }, 220);
175 + }
176 + fab.addEventListener('click', function () {
177 + if (panel.classList.contains('is-open')) {
178 + closePanel();
179 + } else {
180 + openPanel();
181 + }
182 + });
183 + if (closeBtn) {
184 + closeBtn.addEventListener('click', closePanel);
185 + }
186 + document.addEventListener('keydown', function (e) {
187 + if (e.key === 'Escape' && panel.classList.contains('is-open')) {
188 + closePanel();
189 + }
190 + });
191 + })();
192 + </script>
193 + <?php endif; ?>
194 +</div>