OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.44k stars 2.4k forks source link

Feature: Avatar #14291

Open agriffard opened 1 year ago

agriffard commented 1 year ago

Rewatching the custom user display name and avatar by @MikeAlhayek (https://www.youtube.com/watch?v=gXJk9t9tjvU&ab_channel=Lombiq).

Do you plan to include such feature directly in OC? (and split it from display name to be able to enable one or the other, or both?)

Is there a corresponding Liquid filter? It could be useful to display easily the author of a content item on the front.

hishamco commented 1 year ago

@agriffard I already have a Gravatar Module in OCC, which is discussed some time ago in #2829, I will push a PR for it, then @MikeAlhayek might add the feature that demoed it few weeks ago to display the gravatar beside the author everywhere

hishamco commented 1 year ago

Please let me know if sounds is good I will do it ASAP

agriffard commented 1 year ago

Thank you @hishamco but I don't think the default should be using Gravatar.

The best of both worlds would be to be open to other implementations but, at first, media picker seems to be a good start. (There could for example have one generating an avatar with the first letter of the name, Gravatar, identicons, MonsterID.)

hishamco commented 1 year ago

That means we should OrchardCore.Avatar.Abstractions right?

agriffard commented 1 year ago

That means we should OrchardCore.Avatar.Abstractions right?

Probably but let's not overthink it for the first step.

My initial question was to @MikeAlhayek because he seemed to suggest in his demo that it could be in included OC, so let's wait for his answer.

hishamco commented 1 year ago

Sure, meanwhile you can have a look to OCC.Gravatar also User Avatar

MikeAlhayek commented 1 year ago

@agriffard I am not sure if this is something we want to bring into OC. During the demo, @sebastienros was not super exited or did not suggest to bring it to OC. I have no issue bringing it into OC if needed. Meanwhile, you should first test drive it since it is available on nuget. https://www.nuget.org/packages/CrestApps.Components.Users#readme-body-tab

There is liquid helper already as per the readme file. For example, {{ Model.User | display_name }}. There is also an interface called IDisplayNameProvider that you can use to get the display name of the given user.

Since the demo, I made some changes to make it flexible. For example, you can now specify which of the following you want to use in your app, each field can be invisible, required or optional in the UI.

image

image

Also, the display name can have one of the following options image

So if you want a custom format, you can specify liquid like this

image

MikeAlhayek commented 1 year ago

@agriffard I forgot to also mention that "when both the Users and User Display Name featured are enabled, the search functionality within the Users UI will expand to include fields such as display name, first name, middle name, or last name in the search results." you may want to ready the notes in the readme file