Hi,
I made a login based profile pages in my site. The users which register can collect (add) the website content data in their profile pages. In this case I don't know how to do it :). Is there any documentation or suggestions with that? how can I manage the "grav.user" data or any of the variables and write them into yaml user data. thanks
Community guidelines
Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.
The user adds this data when registering, or once logged in there's a form to do that?
Which kind of data does a user enter?
this website hadipisir.com i like to add the recipes which users like to add their profile page ;)
@favio any sugesstions?
You need
1) create a form that will only be shown to logged in users (using the Login Plugin)
2) upon form submission, store this data in the user/data/recipes/ folder, one YAML file for each user. You can see how the Comments plugin achieves this same operation using the onFormProcessed event in https://github.com/getgrav/grav-plugin-comments/blob/develop/comments.php#L178-L245.
The only difference is that Comments has one YAML file for each page, but you'd rather have one per each user
3) in your plugin, expose a "recipes" variable using Twig. Example of how Comments does: https://github.com/getgrav/grav-plugin-comments/blob/develop/comments.php#L75-L78
thanks a lot @flavio :vulcan_salute:
Log in to reply.
Suggested topics
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 13 | 1133 | 4 months ago | ||
| 0 | 60 | 5 months ago | ||
| 9 | 131 | 6 months ago | ||
| 7 | 107 | 7 months ago | ||
| 10 | 125 | 7 months ago |