Question

Photo of Amber McCoy

0

New Lava badge for Missionaries

We have quite a few missionaries we support and I added a "Missionary"  bar tag (where the Member, Visitor bar tag is under their name).  While that is neat and helpful, I also wanted to make a new lava badge with a globe and if they are a missionary then it show up colored and if not, it would be grayed out, similar to the baptism water drop badge.  I also added a Missionary spot to the membership area (under the baptism area).  I am having trouble getting the badge to work properly, it either shows everyone as a missionary or no one as a missionary.  Here is what I have in the lava part: 

{% assign ConnectionStatusValue = Person | Attribute:'Missionary' %}

{% if ConnectionStatusValue == 'Missionary' -%}
<div class="badge badge-missionary" data-toggle="tooltip" data-original-title="{{ Person.NickName }} is a missionary.">
<i class="badge-icon fa fa-globe"></i>
</div>
{% else -%}
<div class="badge badge-missionary" data-toggle="tooltip" data-original-title="{{ Person.NickName }} is not a missionary.">
<i class="badge-icon badge-disabled fa fa-globe"></i>
</div>
{% endif -%}


I copied the baptism lava coding and modified it to missionary and changed the icon.  I've even tried writing the "if-then" from scratch and that doesn't work either.  Can anyone help?  Thanks!

  • Photo of Michael Garrison

    0

    Oops, I do see one thing that may be causing issues... this line:

    {% assign ConnectionStatusValue = Person | Attribute:'Missionary' %}

    may need a bit of massaging. Did you add "Missionary" as a connection status, or as a Person Attribute?

    If the former, try using

    {% assign ConnectionStatusValue = Context.Person.ConnectionStatusValue.Value %}

    instead. (I believe that's still supported Lava, otherwise this is equivalent: {% assign ConnectionStatusValue = Context.Person | Property:'ConnectionStatusValue' | Property: 'Value' %}

    If the latter, just add context like so:

    {% assign ConnectionStatusValue = Context.Person | Attribute:'Missionary' %}
    • Michael Garrison

      The Context. stuff is only required if this in an HTML or similar block...not in a badge. If this is indeed in a true person badge, and you created a Connection Status of "Missionary", then use Person.ConnectionStatusValue.Value instead

  • Photo of Amber McCoy

    1

    I added both a badge in that area shown (and have turned it "on" to show as well as in the bio bar under their name (not sure if that is what it is called but it is the little rectangles that say "member", "Visitor", etc.  I'll try to adjust my lava code and see if that works.  Thanks!

    • Michael Garrison

      I think you'll want to create a different (text-based) badge for the bio bar, but first let's get it working =)
      So since you're dealing with a real badge, use
      {% assign ConnectionStatusValue = Person | Attribute:'Missionary' %} if it's a person attribute you added
      or
      {% assign ConnectionStatusValue = Person.ConnectionStatusValue.Value %} if you created an actual connection status. In this case you could actually use this string in the IF command, rather than storing and using a variable. But if it makes sense to you this way, keep doing what you're doing =)

  • Photo of Amber McCoy

    1

    Woohoo!  It finally works!  Thank you!  The {% assign ConnectionStatusValue = Person.ConnectionStatusValue.Value %} is what did it!  Thanks again! 

  • Photo of Michael Garrison

    0

    Amber, what do you mean by "added a missionary spot to the membership area"? Usually badges (once created under Admin Tools -> General Settings -> Person Profile Badges) just need to be "turned on" in the desired badge block:

    If instead you've inserted an HTML block, for instance, I think the issue is probably one of caching (since your lava looks fine to me). Check the block settings and change the Cache duration from 3600 to 0, in that case.

  • Photo of Amber McCoy

    0

    Thanks. I've already successfully created the text based box in the bio bar (assuming that is under their name at the top). I've also created a missionary attribute in the membership area in the extended attributes tab. 

    My first thought was to make the globe icon lava badge act like the baptism badge, if they have a date, it shows up blue and says they were baptized on whatever day. If they don't have a date it stays grayed out.  I thought I got it to work but then I noticed it was showing up on everyone's file colored in even when the missionary spot was marked no. 

    Since that wasn't working I thought maybe attaching the lava code to the bio bar missionary status would work but it still wasn't working. I'll try the tweaks mentioned above and see if that helps. 

    I did want the "missionary" status to be noted in both places, as their connection status in the bio bar and as a visual icon on the badges bar near the baptism badge. It's also in the membership attribute area I made.