Skip Navigation

[Resolved] Generate a meaningful unique ID

This support ticket is created 2 years, 11 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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by martink-8 2 years, 11 months ago.

Assisted by: Jamal.

Author
Posts
#2130583

Tell us what you are trying to do?
I want to create a unique field will be auto-generated that uniquely identifies a post in products post type.In my example I have two post types,an establishment and a product.I created have a one to many post relationahip where by an establishment can have many products. I Want to use the post title of the establishemt(parent) and combine it with another value(may be post_id of products post type) to create a new unique value that will be used as the post title for products post type.

#2130793

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello and thank you for contacting Toolset support.

You can use the toolset_association_created hook and update the product post title. The action will provide the IDs of both posts(establishment and product) so you can get the title of the establishment and update the title of the product.
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_association_created

I hope this helps. Let me know if you have any questions.

#2130801

please Elaborate further how I'm am going to use the toolset_association_created in the back-end and front-end forms?

#2131383

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Well, custom code can be added on the theme's functions.php file, on a separate plugin, or in a Toolset custom code snippet. Check the following articles:
- https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/
- https://toolset.com/documentation/programmer-reference/adding-custom-code/
- https://toolset.com/documentation/programmer-reference/adding-custom-code/how-to-use-toolset-api-hooks-in-custom-code/

I assume that you are not familiar with programming, right? If yes, I'll help you with this task. I'll need more details on how you are adding Establishments and Products. Are you using the backend? Or are you using Toolset Forms? Would you allow me temporary access to check this closely? Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#2133675
This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.