MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

How to view Name and Surname instead of the username  (Mono Support )

35688 put(a) pogledan, 6 odgovor(a) 28.1.2013. 15:37:21Kreirao(la) afabri73
afabri73

afabri73

28.1.2013. 15:37:21
Hi,
there is a way to view (in all pages that it appears) the name of the users instead of the username.

For example.
17 minute(s) ago by username
Last post ... Posted by username 17 minute(s) ago

become:


17 minute(s) ago by Name Surname
Last post ... Posted by Name Surname 17 minute(s) ago

Ovaj sadržaj još nije ocijenjen. 
115 Reputacija 19 Ukupno objava
pajo

pajo

29.1.2013. 11:21:35
From version 4.7 if user has first and last name entered it should display full name, otherwise it will display username in most modules, but there are some that will still show username and there is no central point where you can change this. Can you tell us what version of MonoX you're using and where you're having problems with display name and I'll see what would be easiest way to change this. In case module is using templates, you can change template to show display name and if you're not that lucky you would need to get dirty and extend controls.
Ovaj sadržaj još nije ocijenjen. 
629 Reputacija 83 Ukupno objava
afabri73

afabri73

29.1.2013. 11:46:48
Thank you,
we are using Monox v4.5.32xx (now I am not in the office)

I look forward to your reply
Best reguard
Adriano
Ovaj sadržaj još nije ocijenjen. 
115 Reputacija 19 Ukupno objava
pajo

pajo

29.1.2013. 13:17:16
Are you able to upgrade MonoX to version v4.7, in the version you're using this will be much harder to achive?
Ovaj sadržaj još nije ocijenjen. 
629 Reputacija 83 Ukupno objava
afabri73

afabri73

29.1.2013. 13:48:30
I know...but at the moment it is impossible to upgrade to the newer version

Ovaj sadržaj još nije ocijenjen. 
115 Reputacija 19 Ukupno objava
pajo

pajo

30.1.2013. 10:35:04
Ok,

Here is a general idea. In case of templates you can access original entity used for binding through $Container.DataItem. First you can try to replace username with $Container.DataItem.AspnetUser.UserDisplayName. There is no guarantee user profile will be fetched and in that case you need to extend webpart and replace username with your display name. You can find basic steps for extending webparts in this blog. Once you extend easiest way is to override ParseTemplateTags, find username tag used in template and replace value with your display name.

protected override Hashtable ParseTemplateTags(BlogEntity blog)
{
  var tags = base.ParseTemplateTags(blog);
  tags["<# UserName #>"] = UserProfileBLL.GetInstance().GetCachedUserProfile(blog.UserId).UserDisplayName;
  return tags;
}
When having small active user base (around 100 users) caching will work just fine, in case of larger user base you should consider fetching profiles from database in that case you would need to override BindData to get list of user ids and fetch their user profiles from db and use this list inside ParseTemplateTags.

When you have extended webpart you must replace MonoX webpart with your own on your pages and that should be it.
Ovaj sadržaj još nije ocijenjen. 
629 Reputacija 83 Ukupno objava