Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Set page frontmatter per link

Started by Paul Richter 7 years ago · 1 replies · 661 views
7 years ago

Hi everyone,

I am trying to implement a simple function but am unsure on how to best do it. Basically I want to display a link on certain pages that, when clicked on adds the current user to the page frontmatter.

Is it possible to do this in twig? If not, do I need a custom plugin? I would appreciate if someone could give me some pointers on how to best solve this.

Thanks in advance,
Paul R.

7 years ago

I think you'll need to create a plugin for that. My route would be to setup a Grav form which submits via Ajax and let the plugin handle the onFormProcessed() event to add the logged in(!) user's username or full name to that page frontmatter and save that file.

Maybe you can re-use code from the Add Page by Form Plugin.

Suggested topics

Topic Participants Replies Views Activity
Support · by TomW, 2 weeks ago
8 227 9 hours ago
Support · by alex, 2 months ago
8 667 23 hours ago
Support · by Supple, 5 days ago
1 98 1 day ago
Support · by TomW, 1 week ago
3 159 3 days ago
Support · by TomW, 6 days ago
2 106 5 days ago