Skip to content

Instantly share code, notes, and snippets.

@champsupertramp
Created November 16, 2015 15:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save champsupertramp/f751241b6430308f1c1a to your computer and use it in GitHub Desktop.
Save champsupertramp/f751241b6430308f1c1a to your computer and use it in GitHub Desktop.
<?php
/**
* Custom sanitization of fields
*/
add_filter('um_profile_field_filter_hook__','my_custom_sanitize_fields', 99, 2 );
function my_custom_sanitize_fields( $value, $data ){
// Add tags to mail value
if ( !is_array( $value ) ) {
if ( is_email( $value ) ){
$value = '<a href="mailto:'. $value.'" title="'.$value.'">'.$value.'</a>';
}
} else {
// implode array values
$value = implode(', ', $value);
}
// Shorten url
if ( $data['validate'] == 'facebook_url' ){
$value = 'https://fb.com/' . $value;
}
return $value;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment