Add option to force display name to be capitlized

This commit is contained in:
champsupertramp
2016-04-21 20:36:45 +08:00
parent 42e95c084a
commit 5c56a2985f
2 changed files with 18 additions and 3 deletions
+9 -3
View File
@@ -1334,14 +1334,18 @@ function um_fetch_user( $user_id ) {
if ( um_user('first_name') && um_user('last_name') ) {
$initial = um_user('last_name');
$f_and_l_initial = strtolower( um_user('first_name') ).' '. strtoupper( $initial[0]);
$f_and_l_initial = um_user('first_name').' '. $initial[0];
}else{
$f_and_l_initial = um_profile( $data );
}
$f_and_l_initial = $ultimatemember->validation->safe_name_in_url( $f_and_l_initial );
$name = ucwords( strtolower( $f_and_l_initial ) );
if( um_get_option('force_display_name_capitlized') ){
$name = ucwords( strtolower( $f_and_l_initial ) );
}else{
$name = $f_and_l_initial;
}
return $name;
@@ -1426,7 +1430,9 @@ function um_fetch_user( $user_id ) {
}
}
$name = ucwords( strtolower( $name ) );
if( um_get_option('force_display_name_capitlized') ){
$name = ucwords( strtolower( $name ) );
}
return apply_filters('um_user_display_name_filter', $name, um_user('ID'), ( $attrs == 'html' ) ? 1 : 0 );
+9
View File
@@ -151,6 +151,15 @@ $this->sections[] = array(
'required' => array( 'display_name', '=', 'field' ),
),
array(
'id' => 'force_display_name_capitlized',
'type' => 'switch',
'title' => __( 'Force display name to be capitalized?','ultimatemember'),
'default' => 1,
'on' => __('Yes','ultimatemember'),
'off' => __('No','ultimatemember'),
),
array(
'id' => 'author_redirect',
'type' => 'switch',