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

Protect tntsearch results page (require login)

Started by Joao Marques 9 years ago · 5 replies · 1072 views
9 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.

9 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.

9 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.

9 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 Vladimir Novak, 2 weeks ago
3 291 2 weeks ago
Plugins · by Mathieu Lecouturier, 3 weeks ago
3 277 3 weeks ago
Plugins · by Slebeig, 2 months ago
1 403 2 months ago
Plugins · by Rene, 2 months ago
2 574 2 months ago
Plugins · by Xavier, 3 months ago
2 490 3 months ago