6 Create a Prayer Wall Shared by Jesse McColm, Pathway Church 4 years ago 9.4 General, Prayer Advanced In an effort to increase our online presence we decided to create a prayer wall. We wanted a way for people to be able to indicate that they had prayed and also make it available to the general public. There are still some improvements we want to make, but we wanted to get it up soon. Eventually we want people to receive an email or text when their request is prayed for. I'll update this when we complete that. Heads up! This recipe has SQL that updates the prayer request table, please exercise caution if you edit the statement. Lava Webhook First we need to create a lava webhook that will allow someone to click the button "I prayed for this" and update the "PrayerCount" column in the database. Navigate to Admin Tools --> General Settings --> Defined Types and find Lava Webhook Create a new Lava Webhook with the following settings: Template Code {% sql statement:'command' %} UPDATE PrayerRequest SET PrayerCount = CASE WHEN PrayerCount IS NULL THEN 1 ELSE PrayerCount + 1 END WHERE Guid = '{{ QueryString.Prayer | SanitizeSql }}' {% endsql %} {% prayerrequest where:'Guid == "{{ QueryString.Prayer | SanitizeSql }}"' %} {{ prayerrequest.PrayerCount }} {% endprayerrequest %} {% comment %} <!--Eventually this will be how we text / email someone when a request is prayed for --> {% workflowactivate workflowtype:'999' PrayerGuid:'{{ QueryString.Prayer }}' %} {% endworkflowactivate %} {% endcomment %} Prayer Wall Page Next you need to create a page for the Prayer Wall. There will be 3 blocks on this page: HTML Content, Prayer Request Entry, and Prayer Request List Lava. Once you have the blocks on the page, add some html to your HTML Content block for a title and maybe some information about the page. Below is an example <div class="col-xs-12 text-center"> <h1 class="bold">Prayer Wall</h1> <h4>How can we pray for you? Share your prayer request (and read and pray for other requests) below.</h4> </div> Set the appropriate settings on the Prayer Request Entry block for your Church. On the advanced settings tab, add the following code into the Pre and Post HTML spots.Pre-HTML:<div class="row" style="padding-bottom:40px;"> <div class="col-xs-12"> <a class="btn btn-primary" data-toggle="collapse" href="#prayer-request-entry" role="button" aria-expanded="false" aria-controls="prayer-request-entry">Share Your Prayer Request</a> </div> <div class="collapse col-xs-12 panel panel-default" id="prayer-request-entry"> <div class="panel-body"> Post-HTML: </div> </div> </div> Lastly we will edit the Prayer Request List Lava block. Be sure to set the settings appropriately. Don't forget to choose the proper category. {% for pr in PrayerRequestItems %} {% if pr.IsPublic %} <div class="panel panel-default prayer"> <div class="panel-body"> <div class="col-md-8 col-xs-6"> <h3>{{ pr.FirstName }}</h3> </div> <div class="col-md-4 col-xs-6"> <button class="btn btn-primary pull-right btn-click-action" data-id="{{ pr.Guid }}">I prayed for this</button> Prayed for <span id="prayerCount-{{ pr.Guid }}" class="badge bg-primary">{{ pr.PrayerCount | Default:'0' }}</span> times </div> <div class="clearfix visible-xs-block"></div> <div class="col-md-12 col-xs-12"><p>{{ pr.Text }}</p></div> <div class="col-md-12 col-xs-12"><p>{{ pr.EnteredDateTime | Date:'M/d/yyyy'}}</p></div> </div> </div> {% endif %} {% endfor %} <script> var btnClassClick = function(e){ e.preventDefault(); e.stopImmediatePropagation(); var guid = $(this).data("id"); //console.log("The data-id of clicked item is: " + guid); $.ajax ({ type: "GET", url: "/Webhooks/Lava.ashx/PrayerUpdate?Prayer=" + guid, success: function(prayerCount) { //console.log('Count increased to: ' + prayerCount); $('#prayerCount-'+guid).text(prayerCount); } }) $(this).text('Thanks for Praying!'); $(this).prop('disabled', true); } $(".btn-click-action").on("click", btnClassClick); </script> Additional Steps That's it! Please look for more to be added soon, with the ability to text / email those who have been prayed for.