Created
July 5, 2018 17:34
-
-
Save verygoodplugins/f05de2867186720013a1b281a97e2d1b to your computer and use it in GitHub Desktop.
Block syncing of user metadata by user role
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Prevents data from syncing to CRM for users with the role "subscriber" | |
function block_updates_by_role( $user_meta, $user_id ) { | |
$user = get_user_by( 'id', $user_id ); | |
if ( in_array( 'subscriber', (array) $user->roles ) ) { | |
return false; | |
} | |
return $user_meta; | |
} | |
add_filter( 'wpf_user_update', 'block_updates_by_role', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment