Skip to content

Instantly share code, notes, and snippets.

@paulgoodchild
Created August 26, 2019 13:17
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/15883f73052c284c020fe3b8a9d3b25d to your computer and use it in GitHub Desktop.
Save paulgoodchild/15883f73052c284c020fe3b8a9d3b25d to your computer and use it in GitHub Desktop.
Filter to adjust whether Two-Factor Authentication is applied to a logged-in user in Shield
<?php
add_filter( 'icwp-wpsf-user_subject_to_login_intent', function ( $bUserSubjectTo2FA, $oWpUser ) {
/**
* Insert Your logic here.
* Parameter $oWpUser is a WP_User object.
* Always return a boolean true/false from this function.
* In this example, if User ID is 1, always apply 2FA rules
*/
if ( $oWpUser->ID === 1 ) {
$bUserSubjectTo2FA = true;
}
return $bUserSubjectTo2FA;
},
100, 2
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment