Skip to:
Content
Pages
Categories
Search
Top
Bottom

Deny Ability To Change Display Name


  • mystylevita
    Participant

    @mystylevita

    I am building a forum for bloggers and I want to be able to control their username for accountability purposes. Each member/blogger will be given a username with their login. They will be able to add their first and last name which then allows them to change the display name to first name, last name, first/last, or username. I would like for the dropdown menu in their edit profile section to ONLY show their username no matter what they input in first/last name fields. Or at least override their selection to always default to the username given to them from the beginning.

Viewing 1 replies (of 1 total)

  • Robkk
    Moderator

    @robkk

    Add this to your functions.php file in your child theme or functionality plugin to remove the display name changer in bbPress and also WordPress.

    add_action('show_user_profile', 'remove_display_name');
    add_action('edit_user_profile', 'remove_display_name');
    
    function remove_display_name($user) { 
        
        if ( bbp_is_single_user_edit() ) {   
            ?>
            	<script>
            		jQuery(document).ready(function() {
            			jQuery('#display_name').parent().hide();
            		});
            	</script>
            <?php 
            
        } else {
            ?>
            	<script>
            		jQuery(document).ready(function() {
            			jQuery('#display_name').parent().parent().hide();
            		});
            	</script>
            <?php }
            
    }    
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar