Answers.Body: <p>There is a <code>currentUser</code> global variable that is available to all Twig templates.</p>
  
  <p>If there is a currently logged in user, it will return that user's <a href="https://craftcms.com/docs/templating/craft.users" rel="nofollow noreferrer">UserModel</a> class.</p>
  
  <p>From there, it's just a matter of:</p>
  
  <pre><code>{% if currentUser %}
      form=http://formsite.com/formname?email={{ currentUser.email }}
  {% endif %}
  </code></pre>
  
  <p>Of course, what's inside the <code>if</code> block will look different depending on how you're generating the embedded code URL.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-11T18:24:33.690Z
Answers.Text: Thank you Brad. I did a bit more digging to figure out all that I needed to do. I created a new matrix field / block , created the html page for it (using your example) and, Voila! I'll be able to build on this.
Answers.UserDisplayName: Jon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-08T22:09:52.853Z
Answers.LastActivityDate: 2018-01-08T22:09:52.853Z
Answers.UserDisplayName: Brad Bell
Body: <p>I need to pass the logged-in user's <em>email address</em> as a variable to a embedded javascript form. I think the easiest way for me to do this is to dynamically embed the user's email address in the embed code URL.</p>
  
  <p>Within the javascript snippet in the HTML block would be a URL "form=<a href="http://www.formsite.com/formname?email=" rel="nofollow noreferrer">http://www.formsite.com/formname?email=</a><strong>XXXX@XXX.COM</strong>" -- how can I pass the logged in user's email into that?</p>
  
  <p>I'm not a web developer nor do I have a lot of experience with craft other than as an admin level user. I'm trying to accomplish this without enlisting the services of a web developer to do any custom work.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-08T17:50:38.897Z
Comments.Text: Have you looked into accessing the `UserModel`? https://craftcms.com/docs/templating/craft.users
Comments.UserDisplayName: Mark Busnelli Jr
Tags: <templating><entries><current-user><blocks>
Title: Include user information in html block
ThreadText: # Include user information in html block
  
  (Asked by: username_0 on 2018-01-08)
  
  I need to pass the logged-in user's *email address* as a variable to a embedded javascript form. I think the easiest way for me to do this is to dynamically embed the user's email address in the embed code URL.
  
  Within the javascript snippet in the HTML block would be a URL "form=<http://www.formsite.com/formname?email=>**XXXX@XXX.COM**" -- how can I pass the logged in user's email into that?
  
  I'm not a web developer nor do I have a lot of experience with craft other than as an admin level user. I'm trying to accomplish this without enlisting the services of a web developer to do any custom work.
  
  **Tags:** templating, entries, current-user, blocks
  
  > **Comments:**
  > **username_1**: Have you looked into accessing the `UserModel`? https://craftcms.com/docs/templating/craft.users  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-01-08. Score: 1 | Accepted answer
  
  There is a `currentUser` global variable that is available to all Twig templates.
  
  If there is a currently logged in user, it will return that user's [UserModel](https://craftcms.com/docs/templating/craft.users) class.
  
  From there, it's just a matter of:
  
  ```
  {% if currentUser %}
      form=http://formsite.com/formname?email={{ currentUser.email }}
  {% endif %}
  
  ```
  
  Of course, what's inside the `if` block will look different depending on how you're generating the embedded code URL.
  
  > **Comments:**
  > **username_0**: Thank you username_2. I did a bit more digging to figure out all that I needed to do. I created a new matrix field / block , created the html page for it (using your example) and, Voila! I'll be able to build on this.  
  
  ---
  
  