I'm working at getting error messages sent from my plugin to my template (on the front end), when there is no session (no logged in user). The plugin is for LDAP authentication.
Edit: For clarification, this plugin (and the error messages) will be for as-of-yet un-logged-in users. Would a session structure be the only way to get the messages to those end users?
I've tried this (below), but I get the error message (below):
code in the plugin controller: craft()->userSession->setFlash('msg_template',"Credentials were not accepted.")
code in the template:
{% set message = craft.app.session.getFlash('msg_template') %}
{% if message|length > 0 %}
{{message}}
{% endif %}
error message:
Neither the property "session" nor one of the methods "session()", "getsession()"/"issession()" or "__call()" exist and have public access in class "Craft\AppVariable