[eluser]edhrx[/eluser]
@joostv
This is something I tried in the past
I have table called record_buffer, with a load of fields in but the interesting fields
are form_id, record_id, uid, posted, is_free
When creating/editing a record a search is made in record_buffer for the record_id where the posted flag = 1..its being edited. This gives the user feed back with a message that
'Joe Bloggs is currently editing the record'
If the posted flag = 0 then it is a stale record.
When creating/editing a record a unique form_id is a hidden field and a record is made in record_buffer ( a stale record can be reused so the table won't grow a great deal). The form_id, uid, timestamp is saved and posted set to 1
Before saving we recheck the posted flag to prevent the user from saving twice.
We can do this because the posted flag is 0 for that form_id following a post
After saving the record the post flag is set to 0.
Thats the basics of how it worked
Ed.