Skip to content

Commit

Permalink
fix akismet and blacklist IP validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pryley committed Jan 14, 2019
1 parent cb0d565 commit b06a18e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion plugin/Defaults/ValidateReviewDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace GeminiLabs\SiteReviews\Defaults;

use GeminiLabs\SiteReviews\Defaults\DefaultsAbstract as Defaults;
use GeminiLabs\SiteReviews\Helper;

class ValidateReviewDefaults extends Defaults
{
Expand All @@ -17,7 +18,7 @@ protected function defaults()
'content' => '',
'email' => '',
'form_id' => '',
'ip_address' => '',
'ip_address' => glsr( Helper::class )->getIpAddress(), // required for Akismet and Blacklist validation
'name' => '',
'rating' => '0',
'terms' => '',
Expand Down
4 changes: 2 additions & 2 deletions plugin/Modules/Validator/ValidateReview.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ protected function validateAkismet()
{
if( !empty( $this->error ))return;
if( !glsr( Akismet::class )->isSpam( $this->request ))return;
$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission (consider adding the IP address to the blacklist):' );
$this->error = __( 'This review has been flagged as possible spam and cannot be submitted.', 'site-reviews' );
}

/**
Expand Down

0 comments on commit b06a18e

Please sign in to comment.