Our old CMS had a Staff Birthday section upon login, so in our transition to Rock, one of the first things we were asked to build to aid in familiarity and adoption, was a block to show Staff Birthdays. The following is a mash up of some searched code from old posts and some customization we used. The end result is a Dynamic Data Block that displays birthdays within the past week as well as for the upcoming month. Next to each is a contact link if you wish to send them a quick note, and on their actual birthday, there is a "Happy Birthday" message along with a cake icon next to them, to alert others visually that it is their ACTUAL Birthday today.

      birthday7.png

1) Hover over the bottom of the window to show the control bar and click on the "Page Zones" to determine where you want to add your block.

      birthday0.png

2) On the Page Zone you wish to add your block to, click the Zone Blocks icon.

      birthday1.png

3) Click the plus sign to add a block to that zone.

      birthday2.png

4) We are adding this block to this Page only (set by default) and you can name it "Birthdays" or whatever you want to call it. Choose "Dynamic Data" as the type. Once added to the list, if you have other blocks in that Page Zone, you can rearrange them by dragging them by the left "hamburger icon" up/down in the list as desired. When ready, click Done on the bottom right.

      birthday3.png

5) Hover over the bottom of the window to show the control bar again, and choose "Block Configuration" this time so we can set up our new Dynamic Data block.

      birthday4.png

6) On the Birthdays block (or whatever you named it) choose the Edit Criteria icon to program this block.

      birthday5.png

7) In the "Query" section, paste the following SQL code.

Query:

SELECT p.[Id], [NickName], [LastName], [Email], [BirthDay], [BirthMonth]
FROM [Person] p
JOIN [GroupMember] gm on p.[Id] = gm.[PersonId]
WHERE (([BirthMonth] = MONTH(GETDATE()) AND [BirthDay] >= DAY(GETDATE()) - 7) OR ([BirthMonth] = MONTH(GETDATE()) + 1) AND [BirthDay] <= DAY(GETDATE()))
AND gm.[GroupId] = 3
AND gm.[IsArchived] = 0
AND gm.[GroupMemberStatus] = 1
ORDER BY BirthMonth ASC, BirthDay ASC;

This should select all current staff. The variables you may want to adjust would be the:

  • GroupID number (GroupId of 3 is our "RSR - Staff Workers" group and you can confirm yours by looking at this page on your install: https://rock.rocksolidchurchdemo.com/page/113?GroupId=3)
  • IsArchived (setting this to 0 only shows those who are not archived, which is what we do to former staff, so this keeps them off our list)
  • GroupMemberStatus (setting this to 1 means they are active)

8) In the "Show Grid Actions" we left them all off except Excel Export, but it won't show up anyway, so really this section isn't important.

9) In the "Formatted Output" section, paste the following HTML code.

Formatted Output:

<div class="panel panel-block"> <div class="panel-heading"><h4 class="panel-title"><i class="fa fa-birthday-cake"></i> Recent & Upcoming Staff Birthdays</h4></div>
<ul class="list-group">
{% for row in rows %}
<li class="list-group-item">
<a href="/Person/{{ row.Id }}">
{{ row.NickName }}
{{ row.LastName }}
</a>
&nbsp;{{ row.BirthMonth }}/{{ row.BirthDay }}&nbsp;
<a href="/Communication?person={{ row.Id }}"><i class="fa fa-envelope"></i></a>
{% assign date = 'Now' | Date:' M/d' %}
{% capture birthdate %}{{ row.BirthMonth }}/{{ row.BirthDay }}{% endcapture %}
{% if date == birthdate %}
&nbsp;<small><i class="fa fa-birthday-cake"></i> Happy Birthday!</small>
{% endif %}
</li>
{% endfor %}
</ul>
</div>

10) The end result should mirror this. Click Save when finished.

      birthday6.png

11) Bask in the glory that is a Staff Birthday list. Impress your coworkers. Enjoy the lunch they buy you for being so savvy. Nice work! :-)

      birthday7.png