Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

 

Too many cooks spoil your broth: multi-user editing alert

In a situation where your "save & publish" changes haven't been saved and published? We've got a fix for you.

Read post

Has this ever happened to you? You are merrily editing your SilverStripe website, working on a large update to one of your pages. You finish your update, hit “save & publish” and walk away, thinking you did a great job. Then your boss phones and asks why the update isn’t live yet. At this point you are confused, thinking: “I could have sworn I hit that ‘save & publish’ button.” You log in to the CMS and your update is gone!

After much investigating, it turns out your co-worker Edith Concurrent was editing pages at the same time that you were, and she corrected a minor typo on the same page that you were working on, overwriting your changes.

How do you prevent that kind of thing happening? Well, now there is a solution. Install the Multi-User Editing Alert module!

Once installed, you will see blue dots in the page tree showing you who is editing at the same time that you are. If you see a red dot that is a conflict where multiple people are on the same page. It’s up to you to use your favourite communication tool to talk to your colleague and discuss who should be editing and saving changes.

As simple as that.

The module works by pinging the server every few seconds with the page that you are currently editing. It also downloads the location of every other content editor in the same API call. To prevent the ping taxing server resources, I’ve made it run in under 150ms. Indeed, most of that time is SilverStripe overhead, the code itself runs in just 12ms.

How does it work so quickly, you ask? It doesn’t use a database—that’s how. It uses the SS_Cache on the local filesystem, or DynamicDB, if you are running on SilverStripe Platform, to save the current state of all editors.

Note: there are still database queries to verify your logged-in state, so can’t run entirely without accessing the database, unfortunately. Also, running a flush clears all the state, if something were to go horribly wrong with the module.

The view of who is editing where updates dynamically as people move around, so you don’t need to refresh the page to see an updated view. Also, all the parties involved in an editing conflict see the alert, if there is a conflict.

You can control the ping frequency with the SilverStripe config system. So, if you have thousands of people editing your site concurrently, then perhaps increase the length of time between each ping to prevent your server crashing. Also, if you are the only person editing at a given point in time, the default ping frequency goes from 3 seconds to 24 seconds to save some server resources. Though again, you can easily adjust these values to anything you like.

If someone logs out, or their browser crashes, the module removes them from the editing alert after 70 seconds of not hearing from them. Naturally, you can modify this timeout period using the config system.

Final extra bonus: the blue and red dots are SVG files that look beautiful zoomed-in on a retina display.

The multiuser-editing-alert module merely alerts you to other’s presence, it doesn’t lock anyone out of editing. If you want to lock users out from editing concurrently, then you can install the Edit Lock module instead. 

Or even install both at the same time, as the two modules play nicely together.

About the author
Julian Seidenberg

Dr. Julian Seidenberg is a Solutions Architect at SilverStripe with a PhD in Computer Science from the University of Manchester. He is an expert in PHP, Javascript and AWS.

Julian mentors a number of SilverStripe’s delivery teams, making sure they have all the information and support they need to do their best work. He also helps to understand SilverStripe’s clients’ needs, making it possible for us to create awesome innovative web technology together.
To ensure that we are aware of the latest technology, Julian does technical research and builds prototypes.

He enjoys working at SilverStripe because we collaborate with interesting clients on ambitious projects. Additionally, he loves how he can be himself at SilverStripe, developing deep bonds of camaraderie with fellow employees and amicably collaborate with everyone.

Julian is technically an American citizen, but was born and grew up in Germany, and is now happily living in Auckland, New Zealand. He enjoys riding his scooter to and from work every day, and arriving home to his young son; who proceeds to run right past him, climb up onto scooter and pretend to ride it. You might also find Julian at The Loft giving talks on the Krishna knowledge of ancient India (ask him about self-realisation and whatnot). He also writes on his personal blog.

Post your comment

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments