Skip Navigation

[Resolved] Custom send notification

This support ticket is created 3 years, 3 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.

This topic contains 3 replies, has 2 voices.

Last updated by ericF-5 3 years, 2 months ago.

Author
Posts
#2190431

Hello,

I wanted to know if there is any way that I can trigger notification to send the mail not only when post get submitted. Also for custom events. Ex. When user login to the account I am creating the custom post which filed data with the data based on cookie generated by user without login and user gets redirect to that post after post gets created, what I want is I wanted to use the notification that already exist in post form I have created. I just want to trigger that notification when my custom code executed.

I have found this function send_notifications but don't know how to get $notificationsToSent variable dynamically based on form id.

Thanks

#2190453

Hello,

We just figured out to achieve this but we facing the issue, the short codes ( [wpv-post-link] other similar to this ) not working with the mail body. It's get replaced with the empty string. Here is the sample code

$faq_form_data = new CRED_Form_Data( 171858, 'cred-form', false );
$manager = new CRED_Notification_Manager_Post;
if ( isset( $faq_form_data->fields['notification']->notifications ) ) {
$manager->send_notifications( $faq_id, 171858, $faq_form_data->fields['notification']->notifications );
}

Any solution for this ?

Thanks

#2190531

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I can't comment on using the Forms code in this way outside of the public API, but there is one thing I can suggest about the shortcodes in the body of your notification.

The shortcodes don't work with deferred notifications (i.e. notifications that happen some time other than when the form is submitted) as they lose track of which post the shortcode refers to. You need to add the attribute item="%%POST_ID%%" to the shortcodes to anchor them to the correct post.

You could try that, although I can't say if it will work in your particular scenario.

#2192579

I don't think that will work, anyway we have found the solution we just overriding the email content. Thank you for help though.