The OSA doesn't differentiate between public U2U services and private services (like ours)
If your forum is a closed community and you don't allow any random to sign up and register then might it not end up falling under the exemptions for things like internal company systems?
HOW can we add their email address to their profile automatically
The easiest way is to edit the
member_about template.
Around about line 60 you'll see blocks of code like this:
HTML:
<xf:if is="$user.Profile.website">
<dl class="pairs pairs--columns pairs--fixedSmall">
<dt>{{ phrase('website') }}</dt>
<dd>
<a href="{$user.Profile.website}" rel="nofollow" target="_blank">{$user.Profile.website|url_display}</a>
</dd>
</dl>
</xf:if>
For each of the fields the
about tab shows in a user's profile. You can add another one for email easily enough. I know you've mentioned you already have permission, but I would personally still be tempted to do one of the following:
- Provide a checkbox to opt in/out of displaying the email
- Provide a separate "displayed email" field which can optionally be completed and displayed
For the sake of a more complete answer let's assume we're going with (1) above. So go and create a new Custom user field (
/admin.php?custom-user-fields/
). Lets assume you call it
displayemail, fill in the title, etc select
preferences as a sensible location for the field, lets make it a
Check boxes and then in the
Options for choice fields section lets set the
Value to
1 and the Text to:
Display my email address on my profile page. Save that, you can always tinker with it again later.
So onto the template modification. Now if you have multiple styles that are independent of each other you'll need to do this to each style. If you just have the one style or their are inherited then modify that one or the parent. Locate the
member_about template and slot this in adjacent to one of the other blocks of code that is displaying a filed (such as location or website, etc).
HTML:
<xf:comment>Display email addresses</xf:comment>
<xf:if is="$xf.visitor.user_id">
<xf:if is="$xf.visitor.Profile.custom_fields.displayemail.1">
<dl class="pairs pairs--columns pairs--fixedSmall">
<dt>{{ phrase('email') }}</dt>
<dd>
{{ $user.email }}
</dd>
</dl>
</xf:if>
</xf:if>
So what are we doing there? Well the first check
<xf:if is="$xf.visitor.user_id">
is just to make absolutely sure we're only going to display this information to a logged in user, so we're making sure the visitor to the page has a
user_id. We're then checking to ensure our user has opted into displaying their email for everyone to see:
<xf:if is="$xf.visitor.Profile.custom_fields.displayemail.1">
, so this is checking our custom field -
displayemail and making sure the value was
1, which is what we set it to when checked. Then finally we get into actually displaying the field name (using a phrase) and the email itself:
{{ $user.email }}
, which you could of course opt to markup with a
mailto anchor tag to make it clickable.
Another option since you mention you have permission to show the emails and your users are not likely to go and do lots of fiddling with settings is to provide them with an
opt-out - which would at least give those that really don't want their email shown an option. Essentially much the same. Lets instead assume you called the custom field:
dontdisplayemail and again set the
Value to
1 and the
Text to:
Don't display to other members my email on my profile page. You'd then use a block like this in the
member_about template:
HTML:
<xf:comment>Display email addresses</xf:comment>
<xf:if is="$xf.visitor.user_id">
<dl class="pairs pairs--columns pairs--fixedSmall">
<dt>{{ phrase('email') }}</dt>
<dd>
<xf:if is="{$xf.visitor.Profile.custom_fields.dontdisplayemail.1}">
{{ phrase('email_hidden') }}
<xf:else/>
{{ $user.email }}
</xf:if>
</dd>
</dl>
</xf:if>
Then create a new phrase in XF:
email_hidden with some suitable text to display when emails are hidden "
Email not available" or whatever. So slightly different here in that I've opted to always show the field label, but only the value (the email) if they have not opted out. You could of course just not display the entire block.
Hope that's enough to get you going. Do remember to test and double check that your user's emails are not visible to the world at large after you've done any tinkering.