Created
November 16, 2015 15:22
-
-
Save champsupertramp/f751241b6430308f1c1a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** | |
* 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