From 8ad84547d8b67d3dfdbc459721e471c8d941f65b Mon Sep 17 00:00:00 2001 From: Navin Karkera Date: Tue, 9 Apr 2024 13:16:38 +0530 Subject: [PATCH] feat: use profile name in navbar if available Makes use of name field from user profile field if it is not empty (cherry picked from commit 53c47bb095b4d885408d1f13589d23673230e520) --- lms/templates/header/user_dropdown.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lms/templates/header/user_dropdown.html b/lms/templates/header/user_dropdown.html index 2e7e168a6937..b4aeafb80c07 100644 --- a/lms/templates/header/user_dropdown.html +++ b/lms/templates/header/user_dropdown.html @@ -19,7 +19,9 @@ self.real_user = getattr(user, 'real_user', user) profile_image_url = get_profile_image_urls_for_user(self.real_user)['medium'] username = self.real_user.username -displayname = get_enterprise_learner_generic_name(request) or username +profile = getattr(self.real_user, 'profile', None) +name = getattr(profile, 'name', username) +displayname = get_enterprise_learner_generic_name(request) or name enterprise_customer_portal = get_enterprise_learner_portal(request) ## Enterprises with the learner portal enabled should not show order history, as it does ## not apply to the learner's method of purchasing content.