Recipe - Show Created/Modified Dates on a Person Profile (Updated for v14+)
Skill level: Beginner
Organization: The Well Community Church
Requires Rock: 1.14.0
{# strip images & classes from the HTML but otherwise leave structure #}
Description
When we migrated to Rock from Fellowship One a few years ago, we quickly realized it would be very helpful in certain situations to know how long ago a person record was created. This recipe simply adds the created and last modified dates to the bio section of a person's profile.
Bonus: We also had some requests to be able to see the last date that a person's home address was modified, so instructions for adding that are also included.
How-To
Person Created/Modified Dates
- Go to a person record and edit the Block Properties of the Person Bio block
- Add this code to the Custom Content field:
{%- assign person = Context.Person %}
{%- if person %}
<div class="mb-3" style="font-size:75%;cursor:default;margin-left:-15px">
{%- if person.CreatedDateTime != null %}
{%- assign creatorAliasId = person.CreatedByPersonAliasId %}
{%- if creatorAliasId != empty %}
{%- assign creator = creatorAliasId | PersonByAliasId %}
{%- capture title %}
data-toggle="tooltip" data-original-title="Created{% if creator != null %} by {{ creator.NickName }} {{ creator.LastName }}{% endif %} on {{ person.CreatedDateTime | Date:'MMMM d, yyyy a\\t h:mm:ss tt' }}"
{%- endcapture %}
{%- endif %}
<span style="opacity:0.4" {{- title }}>Person Record Created: {{ person.CreatedDateTime | Date:'M/d/yyyy' | Default:'Unknown' }}</span>
{%- endif %}
{%- assign title = '' %}
{%- if person.ModifiedDateTime != null and person.ModifiedDateTime != person.CreatedDateTime %}
{%- assign editorAliasId = person.ModifiedByPersonAliasId %}
{%- if editorAliasId != empty %}
{%- assign editor = editorAliasId | PersonByAliasId %}
{%- endif %}
{%- capture title %}
data-toggle="tooltip" data-original-title="Last modified{% if editor != null %} by {{ editor.NickName }} {{ editor.LastName }}{% endif %} on {{ person.ModifiedDateTime | Date:'MMMM d, yyyy a\\t h:mm:ss tt' }}"
{%- endcapture %}
<span style="opacity:0.4">{% if person.CreatedDateTime != null %}|{% else %}Person Record{% endif %}</span>
<span style="opacity:0.4" {{- title }}>Modified: {{ person.ModifiedDateTime | Date:'M/d/yyyy' }}</span>
{%- endif %}
</div>
{%- endif %}
- Save the block properties and you're done!
Home Address Modified Date
- Go to a person record and edit the Block Properties of the Family Members block
- Add this code to the Group Footer Lava field:
<div class="card-section">
{%- assign homeAddresses = Group.GroupLocations | Where:'GroupLocationTypeValueId','19' %}
{%- for homeAddr in homeAddresses %}
{%- if locModifiedDate == null or homeAddr.ModifiedDateTime > locModifiedDate %}
{%- assign locModifiedDate = homeAddr.ModifiedDateTime %}
{%- assign locEditorAliasId = homeAddr.ModifiedByPersonAliasId %}
{%- endif %}
{%- endfor %}
{%- if locModifiedDate %}
{%- if locEditorAliasId and locEditorAliasId != empty %}
{%- assign locEditor = locEditorAliasId | PersonByAliasId %}
{%- endif %}
{%- capture locTitle %}
data-toggle="tooltip" data-original-title="Modified{% if locEditor != null %} by {{ locEditor.NickName }} {{ locEditor.LastName }}{% endif %} on {{ locModifiedDate | Date:'MMMM d, yyyy' }} at {{ locModifiedDate | Date:'h:mm:ss tt' }}"
{%- endcapture %}
<small style="cursor:default;font-size:80%;opacity:0.4" {{ locTitle }}>Last Home Address Update: {{ locModifiedDate | Date:'M/d/yyyy' }}</small>
{%- endif %}
</div>
- Save the block properties and you're done!
Follow Up
Please don't hesitate to leave a comment or hit me up on Rock Chat (@JeffRichmond) if you have questions or find any issues with this recipe.
Change Log
- 2022-03-25 - Initial version
- 2022-04-04 - Added home address modified date
- 2023-10-26 - Updated for the new profile layout in Rock v14+
- 2023-12-15 - Fixed date time formatting to include missing 't' in 'at'
Screenshots
- /GetImage.ashx?guid=f82678a9-0612-449c-b40c-c1314faa0b65
- /GetImage.ashx?guid=b2a4942a-6a9b-48ef-afd5-5609a34f28a7
- /GetImage.ashx?guid=d090968d-400a-4c43-86cf-7c69ae4bcc38