How to display user email for all registered members

AI-generated summary

The discussion revolves around displaying user email addresses for all registered members in a Discourse forum. brucewayne wants to achieve this by making email addresses visible to every member from the user’s summary page.

IAmGav suggests creating a custom field as the easiest solution, which brucewayne later confirms as the best approach.

hawm mentions that overriding the can_check_emails? method in user_guardian.rb could be a solution but raises concerns about making email addresses publicly available. IAmGav agrees that modifying the source code is not ideal as changes would be lost after an update.

merefield advises against making email addresses fully public to avoid attracting crawlers and unwanted attention. brucewayne clarifies that the intention is to make email addresses visible to members only, not publicly.

For those interested in overriding existing Discourse methods in plugins, hawm provides a link to a relevant topic.

Dear Discourse Community,

I am trying to give a public access to all user email addresses.
To be more precise, I would like that every registered member (not only admins) would have an access to a user email address from its member card.
In other words, every member could read an other member email addess from the link :
https://meta.discourse.org/{user}/summary

I tried to modify the file user.hbs, but it seems that only admins have an access to email addresses data.
Is there a way to open the data not only for admins ?

Many thanks for you help,

Richard

Hey Richard,

The easiest way is to setup an custom field for that.

Searching the check_emails and can_check_emails? method in source then override it.

But make emails address publicly really a good idea?

When you update the source, then the edits are gone. not an good idea.

Yes it is. :sweat_smile:I subconsciously think guys will implement it by a plugin.

Just don’t make them fully public or they will leak to all the crawlers and goodness knows who else!

Thank you all for your help !
Best solution is indeed to create a custom field, thank you Gavin. :wink:

Here is the reason why I need to display email addresses for every members :
The Discourse forum on which I’m working is designed for my school network.
The goal is to create a community for graduates and non-graduates people.
Thus, displaying email addresses is a good way to share useful information.


Hawn → just because I’m too curious. How could I have modified the file user_guardian.rb in which the method can_check_emails is stored ?

I know it is possible to modify templates such as .hbs files with plugin-outlet.
But it seems the following script is only designed for template, and not for .rb files :

<script type="text/x-handlebars" data-template-name="/connectors/PLUGIN-OUTLET-NAME/UNIQUE-NAME">

</script>

Many thanks,

Richard

Dear Robert,

I don’t want to make them public, but only visible for members. :wink:

Continute reading more plugins developing related topic you may easy implement it.