Skip to content

Instantly share code, notes, and snippets.

@paulgoodchild
Last active July 31, 2020 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulgoodchild/62b22752bd7246b1000d74f7f3584929 to your computer and use it in GitHub Desktop.
Save paulgoodchild/62b22752bd7246b1000d74f7f3584929 to your computer and use it in GitHub Desktop.
Check Is The Current Visitor IP WhiteListed?
<?php
/**
* Both of these functions return a boolean (true|false) on whether the current visitor
* IP address is whitelisted.
*
* Be sure to use the most appropriate, depending on your Shield version.
*/
if ( class_exists( '\FernleafSystems\Wordpress\Plugin\Shield\Controller\Controller' ) ) {
// Shield up to version 9.1.0
$is_whitelisted = \FernleafSystems\Wordpress\Plugin\Shield\Controller\Controller::GetInstance()
->getModule_IPs()
->isVisitorWhitelisted();
// Shield version 9.1.1+
$is_whitelisted = \FernleafSystems\Wordpress\Plugin\Shield\Helpers\QuickAccess::IsRequestWhiteListed();
}
else {
$is_whitelisted = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment