Derek Jones - 22 August 2007 03:25 PM
A better solution for your unique situation would be a publish form extension that would set the url_title when the form is loaded. At that stage, you could simply do a query where title = ‘Overheard’ ordered by url title, descending, limit 1. Add 1 onto whatever number is on the end of the fetched url title, and set it down in the form field so when you submit, it’s already unique.
Derek,
Sorry for bringing up such an old post but was just wondering how you would even start going about making an extension like this? Also (I could be wrong on this idea here so please do feel free to tell me if I am as I would like to learn from this one) instead of the query you are mentioning could the extension append say the time in seconds since epoch or something else to the end. I would just be worried that if you had lots of people entering data at the same time then you may get two people submit data at the same time? I know this is probably a very very slim chance but I have seen this happen in other database systems in the past.
Not sure if this would be a problem in this case as I’m not even sure how to do what you are talking about and so perhaps ExpressionEngine has some built in way of locking the entry_id as you write it to the database, I guess it does?
Anyway I was just wondering if you wouldn’t mind perhaps giving a quick tutorial on how to go about doing this as I know it would help a lot of people out and I am pretty certain that I may well find myself in this predicament in the very near future so any help on creating this kind of extension would be great thank you.
I have actually already implemented something on an SAEF which just appends the current time to the URL title so that every single entry is unique but would love to know how you go about doing this in the Control Panel. I do understand extensions to a certain limit and the hooks involved but just not certain how to put it all together.
Also if you think that this thread should be moved to another new thread then please do feel free to do so. It’s a bit of a shame that there isn’t a feature on the forums here like you have when a post is finished with that allows you to start a related post but to be able to start one before the existing one is closed? Perhaps might be a nice addition to these forums?
Thanks.
Best wishes,
Mark