Jump to content

Creating a Front-end Demo with Read-only access


Outward
 Share

Recommended Posts

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:

  1. Use the users session info to create a user account and pre-fill login data.
  2. Let them log-in any browse around, but not make any new/save/trash page actions
  3. 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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...