Apps Ballance Chat Click Code Cog_Wheels Compose_email Conference Contacts Earth Edit_File_1_ Email Email_2 File Folder_2 Gift Group Group_2 Help ID ID_2 Key Keys Laptop_Store Link Lock Log_Out Map Marketing Mobile_UI Navigation Partnership Profile Safe_2 Search_User Secure_Files Settings Share Shield Shield_2 Shopping_Cart Support_Male Trash Type_pin User_female User_male logo copy

How to customize the fields output on profile page

Iain Poulson avatar
Iain Poulson Last updated on March 6, 2021

The
wpum_field_ouput_callback_function filter passes 3 arguments, the original callback function used for the field, the field object and the value. See here for the source code

https://github.com/WPUserManager/wp-user-manager/blob/master/includes/wpum-fields/class-wpum-field.php#L626

Example field output customization:

The filter can be used to use a custom function to modify the output of the field within profiles pages. By default WPUM uses separate functions for each field output.

An example can be seen here for the URL field output which prints an HTML anchor tag.
https://github.com/WPUserManager/wp-user-manager/blob/master/includes/wpum-fields/wpum-fields-functions.php#L639

By using the filter, you can tell WPUM to use another function to print the field output on the profile page. In the following example, I’m modifying the output of the Website field, by checking it’s name.
Other methods can be used to determine the field.

Example:

function wpum_custom_field_output( $func_name, $field, $value ) {

	if ( $field->get_name() == 'Website' ) {
		return 'my_custom_function';
	}

	return $func_name;

}
add_filter( 'wpum_field_ouput_callback_function', 'wpum_custom_field_output', 10, 3 );

function my_custom_function( $field, $value ) {
	return '<i><a href="'. esc_url( $value ) .'" target="_blank" rel="noopener noreferrer">'. esc_html( $value ) .'</a></i>';
}

Need more help?

If you still didn't find an answer you can always contact us

Submit a ticket