Skip Navigation

[Resolved] Replace the automatically given title "CRED Auto Draft …" with something else ?

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.

Our next available supporter will start replying to tickets in about 2.43 hours from now. Thank you for your understanding.

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: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by Weber Edouard Marie Anne 1 year, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#2440583

somehow the first input is saved as it should be in the artists (->hidden link) see added picture .

am I right supposing that somehow I should replace the automatically given title "CRED Auto Draft 67e9e21e941c6b1a3338e6b61fde5ef1" with something else ? -> Family-name+name+number (would the number be necessary to prevent an over-writing in case family-name and name of 2 persons are equal or does the data-bank alert before over-writing?

#2440607

Hello,

In the post form "create_artist_post":
hidden link
there isn't post title field, but it is required field to for WordPress to create new post, so Toolset Forms plugin will generate title for you: CRED Auto Draft …

And there isn't such kind of built-in feature to: automatically given title with something else ? -> Family-name+name+number

It needs custom codes, I have setup a demo in your website:

Since your website isn't in English, I have to guess these:
I assume we are talking about the post form for creating new "artist" post:
hidden link
Here are detailed steps:
1) Dashboard-> Toolset-> Settings-> Custom codes, add one item "auto-artist-title", with below codes:

add_action('cred_save_data', function($post_id, $form_data){
  if( !in_array( $form_data['id'], [203] ) ){ 
    return;
  }
  $arr[] = get_post_meta($post_id, 'wpcf-apellido', true);
  $arr[] = get_post_meta($post_id, 'wpcf-nombre', true);
  $arr[] = $post_id;
  $arr = array_filter($arr);
  $post_title = implode('-', $arr);
  $data = array(
    'ID' => $post_id,
    'post_title' => $post_title,
    'post_name' => sanitize_title($post_title),
   );
   wp_update_post( $data );
}, 10, 2);

2) Test it in frontend:
hidden link
fill and submit the form

3) See the results here:
hidden link

More help:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

#2441073

Tis issue is resolved now. Thank you!

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