Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Created March 4, 2020 20:35
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 mgibbs189/f6e2173f5f710c63331cee86fa9cbb3d to your computer and use it in GitHub Desktop.
Save mgibbs189/f6e2173f5f710c63331cee86fa9cbb3d to your computer and use it in GitHub Desktop.
FacetWP - convert User Email into an md5 hash
<?php
/**
* Add to your (child) theme's functions.php
*
* We've added a layout builder item (named "email-md5"), based on the "User Email" field, and set to Hidden
* We've also added a new HTML item with the following content:
*
* <img src="https://www.gravatar.com/avatar/{{ email-md5 }}?s=200" />
*
* This generates the user's profile image (based on Gravatar)
*/
add_filter( 'facetwp_builder_item_value', function( $value, $item ) {
if ( 'email-md5' == $item['settings']['name'] ) {
$value = md5( $value );
}
return $value;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment