PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 3.2.23
MxChat – AI Chatbot & Content Generation for WordPress v3.2.23
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-session-store.php +16 -2 3.2.21 → 3.2.23 View file →
@@ -439,9 +439,18 @@
439 439 * only ever set by the capture paths.
440 440 *
441 441 * @return array[] Rows of [session_id, visitor_email, visitor_name].
442 442 */
443 - public static function identity_rows() {
443 + /**
444 + * Sessions carrying visitor identity.
445 + *
446 + * @param bool $include_nameless_email Also return sessions that have a
447 + * NAME but no email address. Off by default, so every existing
448 + * caller sees exactly the rows it always has; the Leads tab opts in
449 + * when the owner has made the email field optional (c0cfaf), where
450 + * a name-only capture is a real lead rather than a half-filled one.
451 + */
452 + public static function identity_rows($include_nameless_email = false) {
444 453 global $wpdb;
445 454
446 455 if (!self::ensure_table()) {
447 456 return array();
@@ -448,11 +457,16 @@
448 457 }
449 458
450 459 $table = self::table();
451 460
461 + $where = "visitor_email IS NOT NULL AND visitor_email != ''";
462 + if ($include_nameless_email) {
463 + $where = "($where) OR (visitor_name IS NOT NULL AND visitor_name != '')";
464 + }
465 +
452 466 $rows = $wpdb->get_results(
453 467 "SELECT session_id, visitor_email, visitor_name FROM `$table`
454 - WHERE visitor_email IS NOT NULL AND visitor_email != ''",
468 + WHERE $where",
455 469 ARRAY_A
456 470 );
457 471
458 472 return is_array($rows) ? $rows : array();