Skip to content

Commit

Permalink
Ajuste na condição de disparar o e-mail Ref.: #1
Browse files Browse the repository at this point in the history
  • Loading branch information
israelmelo committed Sep 5, 2024
1 parent 831e845 commit 2306614
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,10 @@ public function _init()
$current_timestamp = $current_date_time->getTimestamp();
$eligible_spam = $last_spam_sent ?? $this->spam_sent_email;

if (
$spam_terms &&
(
!$eligible_spam ||
($current_timestamp - $eligible_spam->getTimestamp()) >= 86400
)
) {
$is_spam_eligible = !$eligible_spam || ($current_timestamp - $eligible_spam->getTimestamp()) >= 86400;
$is_spam_status_valid = is_null($this->spam_status) || $this->spam_status;

if ($spam_terms && $is_spam_eligible && $is_spam_status_valid) {
$ip = $_SERVER['HTTP_X_REAL_IP'] ?? $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? '';

foreach ($users as $user) {
Expand Down

0 comments on commit 2306614

Please sign in to comment.