Skip Navigation

[Resolved] Can I make post titles unique?

This thread is resolved. Here is a description of the problem and solution.

Problem: Can I add validation to a CRED form that will force Users to submit unique post titles?

Solution: You can use the cred_form_validate API hook to perform custom server-side validation on any form inputs.

Relevant Documentation: https://toolset.com/documentation/programmer-reference/cred-api/

This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by amandaD 6 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#625332

I have a cred form which allows users to submit Theatre companies (CPT). It seems like some of the companies employees don't communicate with each other, and I sometimes get several submissions from different users, with the same post title (ie, Theatre company name).

Is there a way I can make sure the Post Title is unique?

#625406

Hi, are you asking if it's possible to prevent Users from submitting posts with the same title, or are you asking if it's possible to add some unique identifier to each post title to help identify it? I wasn't clear from your description which you want to accomplish. If you want to prevent the submission of identical titles, you can use the cred_form_validate API to enforce your own custom validation code. If you want to add some unique identifier to each post title, then you can use the cred_save_data API to modify the post title after the CRED form is submitted, maybe add the User ID to the end of the title or something. We have documentation on those API methods available here, with code samples:
https://toolset.com/documentation/programmer-reference/cred-api/

#625558

I want to prevent Users from submitting posts with the same title. Thanks for the info about the cred_form_validate API - I will delve into it and experiment.