// === Helper: Check if MPHB already logged "Zimmercode" sent (DE/EN) === if (!function_exists('elbe6_mphb_already_sent_zimmercode')){ function elbe6_mphb_already_sent_zimmercode($booking_id){ $bid = (int)$booking_id; if ($bid <= 0) return false; if (!function_exists('get_comments')) return false; $comments = get_comments(array('post_id'=>$bid,'number'=>25,'orderby'=>'comment_date_gmt','order'=>'DESC','status'=>'approve')); if (!is_array($comments) || empty($comments)) return false; foreach ($comments as $c){ $msg = is_object($c) ? (string)$c->comment_content : (string)$c; $m = strtolower(wp_strip_all_tags($msg)); if ($m === '') continue; if ((strpos($m,'notification') !== false && strpos($m,'zimmercode') !== false && (strpos($m,'was sent') !== false || strpos($m,'gesendet') !== false)) || preg_match('/notification\s*[\"\\\']?zimmercode[\"\\\']?\s+was\s+sent/i', $m)){ return true; } } return false; }}