I created a "like" flag on the nodes.

I created a comment view.

I want my view to show only comments posted since the flag date.

The solution will be to create a filter criteria with the filter "Comment: Publication date" (Is greater than or equal to) and replace the value with the date of the flag.

The problem is that there are no tokens for the filter criteria.

How to do this with "Views PHP" ?




Views PHP or any other method of stored PHP is a bad idea (What are the downsides of using PHP Filter code in blocks, nodes, views-args, etc?). It's also extremely slow, because it usually involves loading all data and then doing all the processing in PHP.

Instead, build a module and define a views filter plugin there, then you can build the query there how you like it. How exactly to do that is IMHO too complex to answer in a single question, you should find plenty of examples and tutorials on how how to create views filter plugins (there are dozens of plugins in core alone), look for something similar to your use case and start from there.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy