PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 3.2.25
MxChat – AI Chatbot & Content Generation for WordPress v3.2.25
3.2.25 3.2.24 3.2.23 3.2.22 3.2.21 3.2.20 3.2.19 3.2.18 3.2.17 3.2.16 3.2.15 3.2.14 3.2.12 3.2.13 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 3.2.6 3.2.5 3.2.4 3.2.3 3.2.2 3.2.1 All 156 releases
← All changes | includes/class-mxchat-meta-box.php +39 -0 3.2.12 → 3.2.25 View file →
@@ -207,8 +207,31 @@
207 207 </p>
208 208 </div>
209 209 <?php endif; ?>
210 210
211 + <!-- Knowledge base access (plan 6ab002) -->
212 + <?php if (class_exists('MxChat_Knowledge_Manager')) :
213 + $kb_role = get_post_meta($post->ID, '_mxchat_kb_role_restriction', true);
214 + $kb_options = MxChat_Knowledge_Manager::mxchat_role_options();
215 + ?>
216 + <div style="margin-top: 15px;">
217 + <label for="mxchat_kb_role_restriction" style="display: block; font-weight: 600; margin-bottom: 5px;">
218 + <?php _e('Knowledge base access', 'mxchat'); ?>
219 + </label>
220 + <select name="mxchat_kb_role_restriction" id="mxchat_kb_role_restriction" style="width: 100%;">
221 + <option value=""><?php _e('Use tag rules (default)', 'mxchat'); ?></option>
222 + <?php foreach ($kb_options as $role_key => $role_label) : ?>
223 + <option value="<?php echo esc_attr($role_key); ?>" <?php selected($kb_role, $role_key); ?>>
224 + <?php echo esc_html($role_label); ?>
225 + </option>
226 + <?php endforeach; ?>
227 + </select>
228 + <p style="font-size: 12px; color: #666; margin-top: 5px; font-style: italic;">
229 + <?php _e('Who may retrieve this content in chat once it is imported. Tags only work on posts, so this is how you restrict a page. The stricter of this setting and any tag rule wins.', 'mxchat'); ?>
230 + </p>
231 + </div>
232 + <?php endif; ?>
233 +
211 234 <!-- Preview Notice -->
212 235 <div style="margin-top: 15px; padding: 8px; background: #fff3cd; border-left: 3px solid #ffc107; font-size: 12px;">
213 236 <p style="margin: 0; color: #856404;">
214 237 <strong><?php _e('Important:', 'mxchat'); ?></strong>
@@ -260,8 +283,24 @@
260 283 if ($visibility === 'hide') {
261 284 update_post_meta($post_id, '_mxchat_hide_chatbot', '1');
262 285 } else {
263 286 delete_post_meta($post_id, '_mxchat_hide_chatbot');
287 + }
288 +
289 + // Save knowledge-base role restriction (plan 6ab002). Validated against
290 + // the site's real roles, so a stale or forged slug is dropped rather
291 + // than stored as a restriction nothing can satisfy.
292 + if (isset($_POST['mxchat_kb_role_restriction'])) {
293 + $kb_role = sanitize_text_field(wp_unslash($_POST['mxchat_kb_role_restriction']));
294 + $valid = class_exists('MxChat_Knowledge_Manager')
295 + ? array_keys(MxChat_Knowledge_Manager::mxchat_role_options())
296 + : array();
297 +
298 + if ($kb_role !== '' && in_array($kb_role, $valid, true)) {
299 + update_post_meta($post_id, '_mxchat_kb_role_restriction', $kb_role);
300 + } else {
301 + delete_post_meta($post_id, '_mxchat_kb_role_restriction');
302 + }
264 303 }
265 304
266 305 // Save selected bot setting
267 306 if (isset($_POST['mxchat_selected_bot'])) {