Skip Navigation

[Resolved] Change Title upon save AND send notifications

This support ticket is created 5 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 3 voices.

Last updated by Minesh 5 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#924630

I've created CRED forms that do create content. They are used for application forms, that will be saved as CPT, but I also want to send an notification.

This works perfectly, but we would also like to edit the title of the post on submission, containing the post title the form was embeded in... I've used some coding in functions.php i've used before and that perfectly saves the new title... but then the notifications aren't send anymore...

is it correct that when using action hooks (cred_save_data), that the notifications aren't send anymore?

#925020

No, this is not expected.

I tested this as well and cannot confirm that it happens locally.

You must be resting some condition of the notification with the code.
Maybe the notification is fired on a specific condition or moment that you skip or alter with that code?

Are you sure the notifications are sent when the code is not there?
Can you share that code?
And the notification / form settings?

#948160
Edit_Post_Form_‹_NEPC_—_WordPress.jpg

Hi Beda,
thank you for your response... I've tested it again... and yes i can confirm as soon as i add the code in my functions.php which updates the post title, the notification isn't send.

Used code:

add_action('cred_save_data', 'build_title', 10, 2);
function build_title($post_id, $form_data)
{
if ($form_data["id"]==218670) {
  $posttitle = get_the_title($post_id);
  $company = $_POST['wpcf-ae-company-name'];
  $firstname = $_POST['wpcf-ae-first-name'];
  $lastname = $_POST['wpcf-ae-last-name'];

  $new_title = 'Event: '.$posttitle.' | Company: '.$company.' | Contact: '.$firstname.' '.$lastname.' | Date: '.date('D dS \of F, Y').' [ID: '.$post_id.']';
  wp_update_post( array( 'ID' => $post_id, 'post_title' => $new_title ) );
}
}

This correclty changed the post title... but no notification... as soon as i remove it... the notifications are working again.

Notification settings see attached image... it has been set to, on form submission... and send to a field in the post and also a standard email address... when the code isn't used, both addresses do receive the notification... as soon as the code is added... no notifications are received.

#948375

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

First of all - I do not see what Toolset plugins version you are using. Could you please confirm that ALL Toolset plugins are updated to it's latest official released version? If yes:

Could you please share problem URL and access details with me.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#954298

I'm running the latest version of the Toolset plugins, All plugins, Theme, WP is updated.

At this moment I can not afford to have the dev site broken.... therefore I'm waiting with sending the credentials... After I've moved the dev site to production I'm open for letting you in.

Maybe one thing that is important to know... it's a multi site setup. Nor sure if that could have impact on the notifications.

#954299

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please send me problem URL where you added the form and access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

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