0

I'm working on a project that may have two or three content creators. I would like to be able to notify any of them if the other(s) are logged in. This is to prevent one user from editing a post that another user is working on.

Is there a method to tell who is logged in (I would call this regularly) and if possible what page they are viewing or at it's most basic necessity (what page they are editing)?

Note: I have an application that connects to WordPress through the apps internal browser. If the user logs into through their own browser the changes in the application browser and their own browser start to conflict. One might autosave and write over the other. The reason, if you really want to know, is that the Edit panel is great for writing content. My app writes to the custom fields and title. So I use each for their strengths. But having both open at the same time they over write each others values. So I want to even be able to tell the user using my app that they are also logged in via their browser.

  • This is to prevent one user from editing a post that another user is working on. - Latest versions of WordPress doesn't allow a single post/page edit by multiple users at a time. A notice can be seen beside the title in the post list table saying x is currently editing. If you hit the edit button a notice will appear, so that you can take over him/her or close the editing panel. So there's no chance editing same post by two or more users simultaneously. – Mayeenul Islam Dec 22 '15 at 5:46
  • That's good to know. There is a chance that the user could conflict editing with themselves. They may have a session going in the desktop application and then have a session going in the browser. I'm currently able to have both open. Both WordPress and my app use autosave. So it's possible they are overwriting each other. – 1.21 gigawatts Dec 22 '15 at 7:02
  • You will get a notice about revisions dates either way. – s_ha_dum Dec 22 '15 at 22:56
  • @s_ha_dum unfortunately, you won't in this case. I'm modify the custom fields. revisions are created when you edit the post content or title. so my app will save the custom fields data but then if the user edits the post content, a revision is created and the old custom field data is saved and overwrites changes. You can test this. Open a post and change the custom field content and then update the post. no new revisions are created. – 1.21 gigawatts Dec 22 '15 at 23:47
  • @MayeenulIslam I had two edit windows open at the same time (diff computers & user) and didn't see any notification about multiple users but I'm not saying it doesn't work. Just not in my test. I'm going to look into the heartbeat api and see if that will help. – 1.21 gigawatts Jan 19 '16 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.