Skip to content

Instantly share code, notes, and snippets.

@verygoodplugins
Created July 5, 2018 17:34
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 verygoodplugins/f05de2867186720013a1b281a97e2d1b to your computer and use it in GitHub Desktop.
Save verygoodplugins/f05de2867186720013a1b281a97e2d1b to your computer and use it in GitHub Desktop.
Block syncing of user metadata by user role
<?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