Username Privacy
This topic contains 16 replies, has 3 voices, and was last updated by Giri 7 years, 1 month ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
September 28, 2017 at 8:51 am #562
Hello, is there a way that we can mask the users First and Last names? Maybe just display with an initial?
If possible, I would like to have the reviews to be posted with their first name and last name initial, but their profile with their username. The way it is now. So their first name with their last name initial would be on the profile page, but their link would be their /profile/username
I’m not sure if that’s confusing. I think that reviews would look more credible with first names and last initial instead of a username that a member might choose. But at the same time, members may not want their full name being posted.
Thank you.
September 28, 2017 at 11:48 am #563First and last names can be set to “yes/no/let user decide”.
There is a field called Display Name you can make required.That probably solves your issue?
Thanks
September 28, 2017 at 5:08 pm #568No, I would prefer to have the first and last names used, but for privacy reasons, the users last names should be masked.
I also do utilize the display name field, that’s the name that appears in their profile link.
September 28, 2017 at 11:21 pm #572There is no option to only show the first letter of the last name.
You cannot show it, or allow users to decide if it will be shown.Thanks
September 29, 2017 at 12:56 am #573Thank you Guust. Yes, I understand that it’s not available. But perhaps it could be implemented in the next update. I think that this is a reasonable request so maybe @giri may consider it. 😉
September 29, 2017 at 9:52 pm #582Just wanted to update in case anyone else was interested in this feature. I added a code snippet to achieve this. So instead of John Doe members names on the front-end will appear at John D.:
add_action( 'admin_init', 'fix_display_name' ); function fix_display_name() { $users = get_users(); foreach( $users as $user ){ if( $user->first_name != '' && $user->last_name != '' ){ $display_name = $user->first_name . ' ' . substr( $user->last_name, 0, 1 ) . '.'; wp_update_user( array( 'ID' => $user->ID, 'display_name' => $display_name ) ); } } } add_action( 'admin_head', 'hide_profile_field' ); function hide_profile_field() { ?> <script type="text/javascript"> jQuery(function($) { $('.user-nickname-wrap, .user-display-name-wrap').hide(); }); </script> <?php }
September 30, 2017 at 12:45 am #584Thanks for sharing.
October 3, 2017 at 11:56 am #628Hi Joy,
I’m glad you made it work.
Make sure to disable display name field. So your user can’t able to update them.
Also you may need a function to update the display name if your user update the firstname and last name.
Hope that helps.
Thanks
October 3, 2017 at 11:44 pm #640Hi Giri,
Is there a way to get the user names and display names to be set as read only? Also, is there any negative effects if users decide to change their first/last names or their display names? Thank you.
October 4, 2017 at 11:34 am #644Hi Joy, Set the fields to admin use only and then add this snippet.
https://userswp.io/support/topic/disabling-text-box/page/2/#post-486
Thanks
October 4, 2017 at 9:00 pm #656Thanks Giri. However, I don’t see any admin use on the first name, last name, or username fields. I only see the option appear if I add a new text box. Am I doing something wrong? I tried to download and reinstall the latest version from Github too.
October 9, 2017 at 7:10 am #694HI @giri, not sure if you missed my last response since the topic is marked as resolved. Just bumping this again.
Thank you.
October 9, 2017 at 10:58 am #696Hi Joy,
Apologies. I guess I disabled that admin use option for the default fields.
Disabling default fields is not a good idea.
You seem like you are doing it wrong. Are you planning to disable those fields only to display the name differently?
October 9, 2017 at 10:31 pm #707I would just like the account first name, last name, and username to appear on the account settings form, but I want them to be read-only fields.
October 10, 2017 at 2:04 pm #709Hi Joy,
I have added a filter.
You would need to download the latest. I think stiofan is gonna release in wp.org.
So you can get it from there.
Once you have the latest version, add this snippet.
add_filter('uwp_form_input_field_text', 'custom_uwp_form_input_field_text', 10, 3); function custom_uwp_form_input_field_text($field, $value, $form_type) { if ($form_type == 'account') { if ( $field->htmlvar_name == 'uwp_account_first_name' || $field->htmlvar_name == 'uwp_account_last_name' || $field->htmlvar_name == 'uwp_account_username' ) { $field->for_admin_use = '1'; } } return $field; }
Thanks
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket