Outward Posted October 24, 2023 Posted October 24, 2023 Hey everyone, I'm looking for advice from anyone who might have built a demo site using ProcessWire with user login. I have a site that's accessible only via login, and I'd like to create a demo for them to browse around. Everything happens in the front-end, so users are already locked out of the admin panel. It uses the API for just about everything in terms of creating/updating/trashing pages. My idea is as follows: Use the users session info to create a user account and pre-fill login data. Let them log-in any browse around, but not make any new/save/trash page actions After 60 mins, run a lazy cron that will delete their temporary account I'm struggling on point #2 and whether there's hooks or similar I might use. Of course I don't want to show errors, so ideally I would define a pop-up via hook to say for example 'Saving is disabled for this demo'. I think I could manage that if I knew what I was targeting! Has anyone done similar? I know the Skyscrapers site disables saving for example. Thank you!
gs-df Posted October 24, 2023 Posted October 24, 2023 config.php /** * Enable demo mode? * * If true, disables save functions in Process modules (admin). * * @var bool * */ $config->demo = false;
Outward Posted October 24, 2023 Author Posted October 24, 2023 1 hour ago, gs-df said: config.php /** * Enable demo mode? * * If true, disables save functions in Process modules (admin). * * @var bool * */ $config->demo = false; Thanks, I had to check whether I'd ever tried this! Turned out I had, unfortunately it doesn't stop saves being made from the API or front-end, so I think I need to look towards hooks to disabling the key functions like adding, saving and trashing pages.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now