If you are like me, you might need to search the lava docs for the proper way to add a person token to a link so that the link logs them in.  You need to remember to add rckipid= and look at the URL to determine if it has parameters already(use &) or not (use ?).  If you want to set some special parameters on the token, you can, but the length of time is in minutes.  Which is not how I tend to think about these links when sending them in an email.  With all that in mind, I created a shortcode to receive a link and other optional parameters to output a tokenized link.

If you follow the directions below, you only need to use the following shortcode: {[ tokenizelink url:'https://www.yourlink.com' ]} and you will get a shortened tokenized link good for 7 days or three uses.  You can pass the following parameters if you want. 

Here is what you need to do:

  • Create a Lava Shortcode under Admin Tools > CMS Configuration > Lava Shortcodes using the following Properties:
    • Name: Tokenize Link
    • Tag Name: tokenizelink (you can change this to what you want to use to call the shortcode)
    • Tag Type: Inline
    • Description:
      So you have a link that you want to send in an email that will log the person in. You know that the PersonTokenCreate exists and it has parameters and you still need to format the rest of the link to create the full working link. Thow shortcode will let you pass a link and a series of optional parameters to generate the full link.
    • To use this shortcode {[ tokenizelink url:'' ]}.  You can include the base url and it will be parameterized for you.  The number of days active and number of uses has a default value of 7 and 3 respectively.  You can pass these values into the shortcode to change them.

      • days(An Integer) - the number of days the link should be active.
      • uses(An Integer) - the number of times the url can be used before becoming inactive.
      • page(An Id) - Specific page Id that the link should work for.  Anything outside of this page will appear that the user is not logged in.
      • shorten(true/false) - Do you want the output to be a shortlink or not
    • Parameters and Default Values:
      • url - leave blank
      • days - 7
      • uses - 3
      • page - leave blank
      • shorten - true
    • Shortcode Markup
      
      {% assign days = days | Times:24 | Times:60 %}
      
      {% if page and page != empty %}
          {% assign page = page | Prepend:','%}
      {% endif %}
      
      
      {% assign endcheck = url | Right:1 %}
      
      {% if endcheck == '/' %}
          {% assign url = url | ReplaceLast:'/', '' %}
      {% endif %}
      
      {% assign params = url | Split:'?' | Size %}
      {% if params > 1 %}
          {% assign url = url | Append:'&rckipid=' %}
      {% else %}
          {% assign url = url | Append:'?rckipid=' %}
      {% endif %}
      
      {% assign Token = Person | PersonTokenCreate:{{days}},{{uses}}{{page}} %}
      
      {% assign url =  url | Append:Token %}
      
      {% if shorten == 'true' %}
          {{ url | CreateShortLink}}
      {% else %}
          {{url}}
      {% endif %}