Skip to content

Instantly share code, notes, and snippets.

View paulgoodchild's full-sized avatar

Paul Goodchild paulgoodchild

View GitHub Profile
@paulgoodchild
paulgoodchild / adjust_2fa.php
Created August 26, 2019 13:17
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
*/
@paulgoodchild
paulgoodchild / shield_custom_offenses.php
Created June 11, 2019 08:59
[Shield Security] Fire custom security offences. Use this to trigger an offence against an IP address for custom actions that you'd like to consider an offence.
<?php
/**
* Trigger Custom Shield Offense.
*
* Use a WP do_action() call to register a custom offense against an IP address.
* Supported in Shield Security 7.5+
*
* Parameters:
* 1) The action name that we use to register your custom offense. This never changes.
@paulgoodchild
paulgoodchild / custom_roles.php
Created June 2, 2019 08:38
[Shield Security] Add custom user roles for email two-factor authenticaton
<?php
add_filter( 'odp-shield-2fa_email_user_roles', function ( $aRoles ) {
$aRoles[] = 'your_custom_role';
return $aRoles;
} );
@paulgoodchild
paulgoodchild / functions.php
Last active May 8, 2019 10:42
Hide WordPress Core Update Nag/Notification
<?php
add_action( 'admin_init', function () {
remove_action( 'admin_notices', 'update_nag', 3 );
} );