Search
Meerkat

Meerkat

The Auth & User Filters

The auth and user filters allow you to query comments across a variety of authenticated-user status and user-list scenarios.

#The user:from_auth Filter

The user:from_auth filter allows you to filter comments based on if they were left by an authenticated user. It accepts a boolean value, or the wildcard * value (to return comments regardless of if they were left by an authenticated user). The following example would return only those comments left by authenticated Statamic user:

1{{ meerkat:responses filter="user:from_auth(true)" }}
2 
3 {{ comments }}
4 <!-- Render your comment thread here. -->
5 {{ /comments }}
6 
7{{ /meerkat:responses }}

#The user:in Filter

The user:in filter allows you to filter comments based on if the authenticated user identifier is present in the provided list of user identifiers. The following example would return only those comments left by an authenticated Statamic user who's user id is 92283631-5e22-4e21-8764-0aad0cf59bfe:

1{{ meerkat:responses filter="user:in(92283631-5e22-4e21-8764-0aad0cf59bfe)" }}
2 
3 {{ comments }}
4 <!-- Render your comment thread here. -->
5 {{ /comments }}
6 
7{{ /meerkat:responses }}

You may also supply the magic value of *current* to have Meerkat automatically add the currently authenticated Statamic user's identifier as part of the input:

1{{ meerkat:responses filter="user:in(*current*, 92283631-5e22-4e21-8764-0aad0cf59bfe)" }}
2 
3 {{ comments }}
4 <!-- Render your comment thread here. -->
5 {{ /comments }}
6 
7{{ /meerkat:responses }}

If you need a generalized version of the user:in filter, consider checking out the documentation for the where:in filter.

Multiple user identifiers are supported by the user:in filter.

#The not:user:in Filter

The not:user:in filter is the logical opposite of the user:in filter, and allows you to filter comments based on if the authenticated user does not appear in the provided list of user identifiers. The following example would return only those comments that were not left by an authenticated Statamic user who's user id is 92283631-5e22-4e21-8764-0aad0cf59bfe:

1{{ meerkat:responses filter="not:user:in(92283631-5e22-4e21-8764-0aad0cf59bfe)" }}
2 
3 {{ comments }}
4 <!-- Render your comment thread here. -->
5 {{ /comments }}
6 
7{{ /meerkat:responses }}

You may also supply the magic value of *current* to have Meerkat automatically add the currently authenticated Statamic user's identifier as part of the input:

1{{ meerkat:responses filter="not:user:in(*current*, 92283631-5e22-4e21-8764-0aad0cf59bfe)" }}
2 
3 {{ comments }}
4 <!-- Render your comment thread here. -->
5 {{ /comments }}
6 
7{{ /meerkat:responses }}

Multiple user identifiers are supported by the not:user:in filter.

If you need a generalized version of the not:user:in filter, consider checking out the documentation for the not:where:in filter.

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.