FacetWP – convert User Email into an md5 hash

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?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 );

{{/gist}}