0

In my {exp:channel:form}, I'd like my users to create channel entries with the possibility of having identical titles (this is for a forum). Since EE"s {title} has to be unique, I created a forum_title field so that duplicate titles would be allowed in the forum.

However, now I need to set the title dynamically. I can use forum_title as part of the title, but I need something else to ensure it's unique. I was hoping I could add the entry id as a suffix, but this didn't work:

dynamic_title="[forum_title]-ENTRY_ID"

How can I ensure that my dynamic_titles are unique?

Also, is it possible to pass the value of a channel field to the return parameter? This didn't work for me:

return="/forums/ENTRY_ID/[forum_title]/"

1

From my understanding, the title does not need to be unique, only the url_title. If you create two entries with the same title ExpressionEngine will append -1 to the second url_title for you.

As for redirecting, I would return to a simple template return="/forums/submit" and on this template run a channel entries loop, grab the latest post, and create the redirect link manually {redirect="/forums/{entry_id}/{url_title}"}

| improve this answer | |
  • You're right about the {title}! I'll give it a try and get back to you. Is there option other than redirecting? Although not likely, it is possible that the latest post doesn't turn out to be what the user just posted (in case someone submits a new forum around the same time). Also, isn't there a small penalty in terms of speed when redirecting? – ExpressionEngineNewbie Jul 14 '14 at 4:58
  • The redirection take a very small amount of server side processing time yes, but generally no where near enough to be concerned -- like micro micro seconds. I've used this method plenty of times and it's so quick I don't even notice. – Bradley Flood Jul 15 '14 at 5:52
  • As for the grabbing the most recent entry to redirect to, you can filter by author author_id="CURRENT_USER" in the channel entries loop, and you could sort by modified date to get the most recent entry of that author. – Bradley Flood Jul 15 '14 at 5:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.