• Add-ons
  • Blog
  • Resources
    • Documentation
    • FAQs
    • Code snippets
    • Use cases
    • Support
  • Account
    • My account
    • Checkout
    • Cart
  • English
  • French
  • Add-ons
  • Blog
  • Resources
    • Documentation
    • FAQs
    • Code snippets
    • Use cases
    • Support
  • Account
    • My account
    • Checkout
    • Cart
  • English
  • French
home/Knowledge Base/Code snippets/Change the name displayed in user selection box

Change the name displayed in user selection box

104 views 0 April 13, 2021 vprat

On some websites, depending on the user management policy, you could find yourself with users having the same name displayed in the dropdown allowing to select the owner.

Fortunately, there is a hook which allows you to fully customize which information is shown in that dropdown:

add_filter('cuar/core/ownership/owner-display-name?owner-type=usr', 'cuar_change_user_display_field', 10, 2);
function cuar_change_user_display_field($name, $user) { 
    // Show the user name instead of the display name
    return $user->user_login; 
}

Was this helpful?

Yes  No
Related Articles
  • Custom admin notification’s recipients
  • Disable CSS resets and allow integration of third party plugins
  • Automatically add a user to a group
  • Changing the default page shown by the Customer Area
  • Changing the page shown after logout
  • Sidebars: how to disable them
Knowledge base
  • Code snippets
  • Use cases
  • Community links
Documentations
  • Getting started
  • Using code snippets
  • The template system
  • Full documentation
FAQ
  • About licences
  • Pre-sales questions
  • After-sales questions
  • Plugin usage
  • Technical questions
  • Payments
Support
  • Pre-sales Enquiries
  • Main plugin support
  • Premium add-ons support
  • Feature Requests
  • Terms and conditions for sales
  • Refund policy
  • Privacy Policy
  • Legal notices
  • Copyright 2021 wp-customerarea.com. All Rights Reserved.