I have a problem and can't find a solution.

The Problem I have a Google sheet embedded in my site and I want that only one User can enter the site at the same time so that user2 can't see User1 data while editing.

What i tried I played around with scrips inside google sheets but the problem is that there can be two or more users at the same time on the sheet... Now I try to find a solution in wordpress.

Do somebody know how to achieve this?

Possible Ideas

  1. A link that changes when it is in use. After the user leaves the page it changes back so a new user can access
  2. Something probably inside PHP Sessions?

Please help πŸ™πŸ™πŸ™πŸ™ I would be very 😊😊😊

  • I don't imagine WordPress can influence an embedded Google Sheet. How is it embedded, as an iFrame? Can you come up with some other way of collecting the data and adding it to the sheet, e.g. via a form and the sheets API?
    – Rup
    Feb 14, 2021 at 23:08
  • I don't believe there is a WP based solution to this, WP isn't running in the background so you don't know who has an open tab still. Solving this will require realtime live state and something on the server side that is continuously running. My recommendation is to find a solution that doesn't involve multiple users sharing a single embed ( did you know that user 1 can look at the edit history and see what user 2 did even if they're the only person with it open? This will not be secure, and has legal privacy and regulatory consequences )
    – Tom J Nowell
    Feb 14, 2021 at 23:11
  • Hi Rup and thank you for your answerπŸ‘ yes the sheet is embedded via an iframe. That's right an form that would collect the data would be an solution I already thought about, but for the users it would be easier to understand the input when they see the whole sheet at once.
    – Proboto
    Feb 14, 2021 at 23:13
  • Hi Tom J Nowell and thank you for your precise answer πŸ‘ this help me a lot and I will try to find another solution. I don't know about this before you told me!!! Big thanks πŸ’“
    – Proboto
    Feb 14, 2021 at 23:17


Your Answer

By clicking β€œPost Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.