User name and email in URL parameters



  • Karen Snyder
    Community Moderator

    Amanda Morphew-Ulm you can do this by putting an empty div into new_request_page.hbs and then using JavaScript to insert the <a href element. The HelpCenter object which is accessible to JavaScript contains the user name and email.

    The steps would be:

    1. In new_request_page.hbs, insert the following wherever you want the link to appear. This provides a div that the JavaScript can place the <a href element in.

    <div id="insertGoogleUrl"></div>

    2. Insert the following code before the first line of new_request_page.hbs. It inserts the <a href element into the div. It gets the user name and email from the HelpCenter object. It also replaces any blanks in the user name with %20, because blanks in URLs need to be encoded (see

      $(document).ready(function () {
        var htmlString = '<a href="' +
   ' ', '%20') + '&email=' +
              + '">Visit Google</a>';

    Please note that this code works only in themes where jquery can be used (templating API v1). Please let me know if you have any questions.



Please sign in to leave a comment.

Powered by Zendesk