Search
Meerkat

Meerkat

The "is" Filters

The is filters provide specialized filters for targeting specific comment properties, or a range of properties;

#The is:before Filter

The is:before filter allows you to filter comments to those that appear before a certain date. It accepts either a UNIX timestamp, or the date as text input. The following example would return all comments that were submitted to the server before January 1st, 2021:

Time Zones

Meerkat stores all dates as UTC timestamps.

1{{ meerkat:responses filter="is:before(Jan 1st 2021)" }}
2 
3 {{ comments }}
4 <!-- Render your comment thread here. -->
5 {{ /comments }}
6 
7{{ /meerkat:responses }}

Meerkat uses Carbon to parse date/time strings.

#The is:after Filter

The is:after filter allows you to filter comments to those that appear after a certain date. It accepts either a UNIX timestamp, or the date as text input. The following example would return all comments that were submitted to the server after January 1st, 1990:

Time Zones

Meerkat stores all dates as UTC timestamps.

1{{ meerkat:responses filter="is:after(Jan 1st 1990)" }}
2 
3 {{ comments }}
4 <!-- Render your comment thread here. -->
5 {{ /comments }}
6 
7{{ /meerkat:responses }}

#The is:between Filter

The is:between filter combines the is:after and is:between filters to filter comments that fall within a range of dates. It accepts two arguments: the since date and the until date. The since date must be provided as the first argument, and the until date must be provided as the second argument. The following example returns all comments submitted after January 1st, 1990 but before January 1st, 2021:

Time Zones

Meerkat stores all dates as UTC timestamps.

1{{ meerkat:responses filter="is:between(Jan 1st 1990, Jan 1st 2021)" }}
2 
3 {{ comments }}
4 <!-- Render your comment thread here. -->
5 {{ /comments }}
6 
7{{ /meerkat:responses }}

The inline syntax with Antlers currently does not support (or handle well) input that contains quotes or commas inside strings. For example, if your date input is in the format of "Jan 1st, 2021" you would need to use Custom Variable Input in order to accomplish this.

The following example demonstrates how to supply complicated input (input with either commas or quotes):

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

In the meerkat/filters.php helper file:

1<?php
2 
3use Stillat\Meerkat\Support\Facades\Comments;
4 
5Comments::resolve('myDates', function () {
6 return [
7 'Jan 1st, 1990',
8 'Jan 1st, 2021'
9 ];
10});

#The is:spam Filter

The is:spam filter allows you to filter comments based on whether or not it is considered spam. It accepts a boolean value, or the wildcard (*) value. The following example filters all comments that were flagged as spam:

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

#Spam Check Tip

If you wanted to retrieve all comments that have not yet been flagged as either spam or not spam, you can use the where filter to check if that value has not been set:

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

#The is:published Filter

The is:published filter allows you to filter comments based on whether or not it was approved by a Statamic Control Panel user. It accepts a boolean value, or the wildcard (*) value. The following example filters all comments that were not approved by a Control Panel user:

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

#The is:deleted Filter

The is:deleted filter allows you to filter comments based on whether or not a comment has been soft deleted. It accepts a boolean value, or the wildcard (*) value. The following example returns all comments that were soft deleted:

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

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.