I want to show messages that we exchanged with a user. The username is a query parameter in the URL.
I'm using the free plugin url-parms for getting the value of the username from the query string.
The username will be shown and used to filter the messages.
Showing the username works, but filtering causes a critical error.
This is my code:
{% set username = [urlparam param = 'username' /] %}
<h1>Chat with <strong>[urlparam param = 'username' /]</strong></h1>
{% set args = {
post_type: 'tg-message',
posts_per_page: 50,
orderby: 'date',
order: 'DESC',
title: username
} %}
{% set messages = mb.get_posts(args) | reverse %} {# Reverse the array for ascending display #}
This is the error: PHP Fatal error: Uncaught eLightUp\Twig\Error\SyntaxError: An array element must be followed by a comma. Unexpected token "name" of value "param" ("punctuation" expected with value ",") in ....
How to get the value from the query parameter working?