This filter hook runs before the profile information (custom fields) are displayed in User Profile. Allowing you to tweak and integrate whatever functions or conditions you need to apply to the returned custom field value.
Usage Example
This is an example that modifies the custom field value of user gender output to say something custom, instead of just showing Male or Female.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<?php add_filter('userpro_before_value_is_displayed', 'userpro_gender_value', 99, 4); function userpro_gender_value($value, $key, $array, $user_id) { /* In this example, we check if custom field key is gender and if value is Male/Female we adjust what is the value returned easily */ if ($key == 'gender') { if ($value == 'Male') { return 'I am Male!'; } else { return 'I am Female!'; } } return $value; } ?> |
Leave A Comment?