Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Protect tntsearch results page (require login)

Started by Joao Marques 8 years ago · 5 replies · 902 views
8 years ago

Hi!
I've installed tntsearch and would like to protect the /search page requiring the user to login before he can make any search.

I'm using the learn2 skeleton witch already uses the login plugin.

Already tried adding this to the tntsearch.html.twig partial:

YAML
---
access:
    site.login: true
---

And also tried adding this to the tntsearch.yaml file:

YAML
access:
    site.login: true

None of them worked.

8 years ago

You are close to the solution. The trick is not to add:

YAML
---
access:
    site.login: true
---

to the Twig template but to the page header or frontmatter of the /search page instead.

You may have to create that page if I understand the docs correctly.

8 years ago

Thank you, it worked.

But I think since I'm editing a plugin file (user/plugins/tntsearch/pages/search.md) it could be overwritten in a future update of the tntsearch plugin. The perfect solution would be one that can continue to work when the plugin is updated.

8 years ago

In Customizing the Search Page it is stated that the plugin uses the search page it provides if there is no physical Grav page at the search path route. So, I assume that when you copy the plugin's search page and make that accesible through the (configured?) search route you are set.

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 43 1 week ago
Plugins · by Xavier, 4 weeks ago
2 53 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1179 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 48 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 72 2 months ago