Answers.Body: <p>Fixed by using</p>
  <pre><code>  {% if craft.follow.check({ elementId: elementId }) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-11T21:46:32.357Z
Answers.LastActivityDate: 2020-11-11T21:46:32.357Z
Answers.UserDisplayName: JMKelley
Answers.Body: <p>Your code looks correct. Test with the following code in <code>brands/_followButton</code>.</p>
  <pre><code>{{ currentUser ? 'Logged in' : 'Logged out' }}
  </code></pre>
  <blockquote>
  <p>For some reason, it's not working and I can't figure out why.</p>
  </blockquote>
  <p>Can you explain what specifically is not working? And provide the version of Blitz that you're using?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-11T21:31:26.107Z
Answers.Text: Removing the follow button code within the partial and replacing it with the above renders "Logged In" and "Logged Out" in both states fine. So it must come down to the "followCheck" and entry.id.
Answers.UserDisplayName: JMKelley
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-10T18:01:25.350Z
Answers.LastActivityDate: 2020-11-10T18:01:25.350Z
Answers.UserDisplayName: Ben Croker
Body: <p>I have a Dynamic Blitz template with a currentUser if statement within it. For some reason, it's not working and I can't figure out why.</p>
  <p><strong>It gets loaded in as follows:</strong></p>
  <pre><code>{{ craft.blitz.getTemplate('brands/_followButton', { elementId: entry.id }) }}
  </code></pre>
  <p><strong>The code on the page running it:</strong></p>
  <pre><code> {% if currentUser %}
    {% if craft.follow.check({ elementId: entry.id }) %}
      &lt;a class=&quot;btn btn-sm btn-light py-2 px-3 mr-2&quot; rel=&quot;nofollow&quot; href=&quot;{{ craft.follow.unfollowUrl(entry.id) }}&quot;&gt;&lt;span class=&quot;material-icons mr-2 md-18&quot;&gt;favorite&lt;/span&gt;Unfollow&lt;/a&gt;
    {% else %}
      &lt;a class=&quot;btn btn-sm btn-light py-2 px-3 mr-2&quot; rel=&quot;nofollow&quot; href=&quot;{{ craft.follow.followUrl(entry.id) }}&quot;&gt;&lt;span class=&quot;material-icons mr-2 md-18&quot;&gt;favorite_border&lt;/span&gt;Follow&lt;/a&gt;
    {% endif %}
  
    {% else %}
      &lt;a class=&quot;btn btn-sm btn-light py-2 px-3 mr-2&quot; rel=&quot;nofollow&quot; href=&quot;/register&quot;&gt;&lt;span class=&quot;material-icons mr-2 md-18&quot;&gt;favorite_border&lt;/span&gt;Follow&lt;/a&gt;
  {% endif %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-09T18:47:46.087Z
Comments.Text: If you hit the ``_followButton`` template template directly does it show correctly?
Comments.UserDisplayName: RitterKnight
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-10T15:45:06.047Z
Comments.Text: @RitterKnight What do you mean sorry?
Comments.UserDisplayName: JMKelley
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-10T17:36:09.573Z
Comments.Text: The partial loads perfectly when I'm not logged in.
Comments.UserDisplayName: JMKelley
Tags: <templating><plugins><plugin-blitz>
Title: Dynamic Blitz Template not loading currentUser
ThreadText: # Dynamic Blitz Template not loading currentUser
  
  (Asked by: username_0 on 2020-11-08)
  
  I have a Dynamic Blitz template with a currentUser if statement within it. For some reason, it's not working and I can't figure out why.
  
  **It gets loaded in as follows:**
  
  ```
  {{ craft.blitz.getTemplate('brands/_followButton', { elementId: entry.id }) }}
  
  ```
  
  **The code on the page running it:**
  
  ```
   {% if currentUser %}
    {% if craft.follow.check({ elementId: entry.id }) %}
      <a class="btn btn-sm btn-light py-2 px-3 mr-2" rel="nofollow" href="{{ craft.follow.unfollowUrl(entry.id) }}"><span class="material-icons mr-2 md-18">favorite</span>Unfollow</a>
    {% else %}
      <a class="btn btn-sm btn-light py-2 px-3 mr-2" rel="nofollow" href="{{ craft.follow.followUrl(entry.id) }}"><span class="material-icons mr-2 md-18">favorite_border</span>Follow</a>
    {% endif %}
  
    {% else %}
      <a class="btn btn-sm btn-light py-2 px-3 mr-2" rel="nofollow" href="/register"><span class="material-icons mr-2 md-18">favorite_border</span>Follow</a>
  {% endif %}
  
  ```
  
  **Tags:** templating, plugins, plugin-blitz
  
  > **Comments:**
  > **username_1**: If you hit the ``_followButton`` template template directly does it show correctly?  
  > **username_0**: @username_1 What do you mean sorry?  
  > **username_0**: The partial loads perfectly when I'm not logged in.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2020-11-11. Score: 0 | Accepted answer
  
  Fixed by using
  
  ```
    {% if craft.follow.check({ elementId: elementId }) %}
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2020-11-10. Score: 1
  
  Your code looks correct. Test with the following code in `brands/_followButton`.
  
  ```
  {{ currentUser ? 'Logged in' : 'Logged out' }}
  
  ```
  
  > For some reason, it's not working and I can't figure out why.
  
  Can you explain what specifically is not working? And provide the version of Blitz that you're using?
  
  > **Comments:**
  > **username_0**: Removing the follow button code within the partial and replacing it with the above renders "Logged In" and "Logged Out" in both states fine. So it must come down to the "followCheck" and entry.id.  
  
  ---
  
  