Adding an Email Button to the Person Profile Page

  • By Josh LeVeque One Year Ago

We've all had that frustration, or at least gotten a call from a user saying, "I clicked a person's email address in Rock and it brings up the communication window. I just wanted to send an email from [outlook/mail/whatever default mail client]." If you don't want to change the default action, found in global attributes, preferred email link type.

You could always copy and paste the email address into a mail client, but why not give users a choice?

Well, with a bit of lava you can. Edit the properties on the bio block of the person profile.

screen.png

Enter some lava in the Post-HTML under advanced settings:

screen1.png

<div style="text-align:center;"> {% assign person = PageParameter['PersonId'] %} {% assign thisperson = person | PersonById %} {% if thisperson.Email != '' %} <a class="btn btn-primary eml-btn" href="mailto:{{ thisperson.Email}}"><i class="fa fa-envelope"></i> Email {{ thisperson.NickName}}</a> {% endif %} </div>

Viola, you now have a nice Email button below the bio section to allow you to send an email with your default mail client.

EDIT: Kevin Rutledge on Slack suggested adding the link to the last item in the personcontact div instead, which makes a much cleaner solution. To do this, you can insert jquery for the following:

<script>$( ".personcontact" ).append( "<div style=\"padding-top:5px;\"> {% assign person = PageParameter['PersonId'] %} {% assign thisperson = person | PersonById %} {% if thisperson.Email != '' %} <a class=\"btn btn-primary eml-btn\" href=\"mailto:{{ thisperson.Email}}\"><i class=\"fa fa-envelope\"></i> Email {{ thisperson.NickName}}</a> {% endif %} </div>" );</script>


@joshleveque
West Side Christian Church
Springfield, IL