From 5c56a2985fd023d84233956bed4b00ea94b1f088 Mon Sep 17 00:00:00 2001 From: champsupertramp Date: Thu, 21 Apr 2016 20:36:45 +0800 Subject: [PATCH] Add option to force display name to be capitlized --- core/um-short-functions.php | 12 +++++++++--- um-config.php | 9 +++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/core/um-short-functions.php b/core/um-short-functions.php index 2b093548..c10a60d6 100644 --- a/core/um-short-functions.php +++ b/core/um-short-functions.php @@ -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 ); diff --git a/um-config.php b/um-config.php index 7051857e..9393cecd 100644 --- a/um-config.php +++ b/um-config.php @@ -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',