How can I show the user's e-mail address in the Users topic?

The UserForm does not show the e-mail address, and with TopicUserMapping, the e-mail address is never copied to the UserForm.

The e-mail address can be retrieved using the %USERINFO% macro. This macro follows the User security setting {AntiSpam}{HideUserDetails} which is managed in the configure interface. In order to automatically display the user's e-mail address in the User's topic:
  • Edit the form attached to the User's topic
  • Insert into the Email field:
    %USERINFO{"%TOPIC%" format="$emails"}%
The user form will then follow the setting of {AntiSpam}{HideUserDetails}. If disabled, all users including guest will see the user's e-mail address in the User's topic. If enabled, then users can see their own addresses, and administrators will see all addresses.

In order to automate this for new users, add the macro to the NewUserTemplate

Developer Information

With TopicUserMapping, and HtPasswdUser, e-mails are never stored in the user's topic. Emails are written to the .htpasswd file.

The register function lib/Foswiki/UI/Register.pm copies the fields from the registration form to the User topic. It explicitly omits the email address. There is an option in the code specifying which fields are skipped, defined right at the top of the module. ALERT! If this option is changed, the email will be copied, but Foswiki will still use the hidden email in .htpasswd. The email in the User topic will be visible but unused by Foswiki. Changes to this module are not recommended.

HtPasswdUser.pm controls whether or not it manages email addresses. The function isManagingEmails returns 1 (true) and passwords are written to and managed in .htpasswd. If this is changed to return 0 (false), then TopicUserMapping.pm takes over and manages the passwords directly in the UserForm in the User's topic. Note that it is recommended that this modules not be modified. It should be copied to a custom Password manager so that Foswiki upgrades don't revert the changes.

Support.FAQForm edit

TopicClassification FrequentlyAskedQuestion
Subject Registration or Authentication or Authorisation
Topic Summary Adding the user e-mail address to the UserForm
Extension
Interested Parties
Related Topics
Topic revision: r2 - 27 Dec 2011, ArthurClemens - This page was cached on 25 Sep 2017 - 04:53.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License