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

Login plugin - Serve different modules/different data to different users

first-time

Started by Andrew 8 years ago · 2 replies · 544 views
8 years ago

Hi everyone,

I have a question about Login plugin - is there a way to serve content to users based on their userdata?

Example: I am hosting an event, one guy in the crew works on applications, other handles already admitted people, third works with statistical data on how many applied/were admitted. I'd like to have sort of a Control panel hosted on mysite.com/cp, accessible to those with user accounts only, where each of the crew will be served data that he needs: first guy will get a table of new applicants, second - a table of those who were admitted by the first one, and the third will see a chart of the progress made by the first two.

Can I get that with something that already exists (Grav inherent functions/Login plugin capabilities/other plugins)? I think it is possible by making /cp modular and setting up module load rules based on userdata, but I can't quite figure out the way to do it.

Best regards,
Andy

8 years ago

If anyone will get a similar question in future - I think I found a good way to do what I needed: variable grav.user.username, as well as other grav.user.### variables can be accessed and compared to the string via "same as", using "if" statement you can write a template that will serve some content only to certain users.
Maybe there is a better way to do what I want, but this one seems to work well. Don't forget to disable caching for such pages.

8 years ago

You can integrate such stuff into the Admin plugin as an add-on. Admin plugin knows about permission groups and users can be owners of different permissions, e.g. admin.super or admin.eventcharts. Obviously this needs some programming, you need a dedicated add-on plugin for your event management.

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 54 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1181 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 73 2 months ago