Involver Developer Network : registration_code
This page last changed on Oct 24, 2011 by jed.wheeler@involver.com.
OverviewUsed for giving out unique codes to users, for example for offsite promotions. This feature block provides a JavaScript method: RegistrationCodeFeature.requestCode(feature_id, success_title, success_message, prefix_html) You may also use the related JavaScript class sml.tag.RegistrationCode.
ConfigurationAdding registration_code tag to the SML template editor and saving it: {% registration_code name:"your_custom_name" %}{% endregistration_code %}
will allow you for further feature configuration. Registration codes can be added from within the SML settings. All you need to do is upload a CSV file in the following format, one code per line. Code, Max Uses, Expires At <code 1>,<max_uses>,<MM/DD/YYYY> <code 2>,<max_uses>,<MM/DD/YYYY> <code 3>,<max_uses>,<MM/DD/YYYY> Attributes
Context Variables
ExamplesSimple ExampleUse the default messages: <button onclick="RegistrationCodeFeature.requestCode({{ registration_code.id }});">Get Code</button>
Complex ExampleTrigger the request after a successful signup from a signup_form: {% registration_code %} {% comment %} We need this separate function, since we can't embed an SML variable in the onsuccess directly. {% endcomment%} <script type="text/javascript"> function success() { RegistrationCodeFeature.requestCode({{ registration_code.id }}, "Free promo code", '<h3>[[code]]</h3>', '<img src="http://www.example.com/logo.png" alt="Logo">'); } </script> {% signup_form name:"signup" onsuccess:"success();" %} <div class="signup"> <ol> <li> <label for="confirm_email">Confirm Email</label> <input type="text" name="confirm_email"> </li> </ol> <p>{% signup_form_submit %}</p> </div> {% endsignup_form %} {% endregistration_code %} FAQThere are currently no FAQs for this feature block. Related Topics![]() ![]() |
![]() |
Document generated by Confluence on Feb 12, 2013 09:09 |