<p>Fixed by using</p>
<pre><code>  {% if craft.follow.check({ elementId: elementId }) %}
</code></pre>

CC BY-SA 4.0
2020-11-11T21:46:32.357Z
2020-11-11T21:46:32.357Z
JMKelley
<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>

CC BY-SA 4.0
2020-11-11T21:31:26.107Z
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.
JMKelley
CC BY-SA 4.0
2020-11-10T18:01:25.350Z
2020-11-10T18:01:25.350Z
Ben Croker
<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>

CC BY-SA 4.0
2020-11-09T18:47:46.087Z
If you hit the ``_followButton`` template template directly does it show correctly?
RitterKnight
CC BY-SA 4.0
2020-11-10T15:45:06.047Z
@RitterKnight What do you mean sorry?
JMKelley
CC BY-SA 4.0
2020-11-10T17:36:09.573Z
The partial loads perfectly when I'm not logged in.
JMKelley
<templating><plugins><plugin-blitz>
Dynamic Blitz Template not loading currentUser
# 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 }) %}
    favoriteUnfollow
  {% else %}
    favorite_borderFollow
  {% endif %}

  {% else %}
    favorite_borderFollow
{% endif %}

**Tags:** templating, plugins, plugin-blitz
> **Comments:**
> **username_1**: If you hit the ``_followButton`` template template directly does it show correctly?  
> **username_0**: @RitterKnight 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.  

---

