Home › Forums › Front End PM PRO › Please add new case to fep_user_name to include usermeta "last_name_suffix"
- This topic has 1 reply, 2 voices, and was last updated 8 years ago by Shamim Hasan.
- AuthorPosts
- May 18, 2018 at 1:18 am #14295Kyle PutnamParticipant
function fep_user_name( $id ){
$which = apply_filters( ‘fep_filter_show_which_name’, ‘display_name’ );switch( $which ){
case ‘first_last_name_suffix’:
$name = fep_get_userdata( $id, ‘first_name’, ‘id’ ) . ‘ ‘ . fep_get_userdata( $id, ‘last_name’, ‘id’ ). ‘ ‘ . fep_get_userdata( $id, ‘last_name_suffix’, ‘id’ );
break;case ‘first_last_name’:
$name = fep_get_userdata( $id, ‘first_name’, ‘id’ ) . ‘ ‘ . fep_get_userdata( $id, ‘last_name’, ‘id’ );
break;
case ‘last_first_name’:
$name = fep_get_userdata( $id, ‘last_name’, ‘id’ ) . ‘ ‘ . fep_get_userdata( $id, ‘first_name’, ‘id’ );
break;
case ‘first_name’:
case ‘last_name’:
case ‘user_login’:
case ‘user_nicename’:
$name = fep_get_userdata( $id, $which, ‘id’ );
break;
case ‘display_name’:
default:
$name = fep_get_userdata( $id, ‘display_name’, ‘id’ );
break;
}
return apply_filters( ‘fep_filter_user_name’, $name, $id );
}I have modified my FEP functions.php file to include this additional option and it is working perfectly. I would just like it incorporated into your code so it won’t get lost during updates. Thanks!
May 18, 2018 at 5:13 am #14298Shamim HasanKeymasterPlease do not change any plugin code. It will be overwritten when you update plugin.
There are lots of hook in this plugin. So you can change almost anything without touching plugin code.
To achieve this functionality without changing plugin code, please add following code in your theme’s ( child theme’s if any) functions.phpadd_filter( 'fep_filter_user_name', function( $name, $id ){ $name = fep_get_userdata( $id, 'first_name', 'id' ) . ' ' . fep_get_userdata( $id, 'last_name', 'id' ) . ' ' . fep_get_userdata( $id, 'last_name_suffix', 'id' ); return $name; }, 10, 2 ); - AuthorPosts
You need to purchase ‘Front End PM PRO’ to create topic in this support forum.
If you already purchased ‘Front End PM PRO’ please LOGIN.