Skip Navigation

[Gelöst] CRED- shortcodes in Notifications don't work

This support ticket is created vor 7 Jahre, 8 Monate. 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 10 Antworten, has 2 Stimmen.

Last updated by mellisaB vor 7 Jahre, 8 Monate.

Assigned support staff: Beda.

Author
Artikel
#303284

I have a CRED form that grabs data from the parent post along with Name, Email and Phone form fields and saves a child post in a Leads CPT. Notifications work correctly. I would like to create my own customized notification with data from the created post, or the parent post, along with the name and email entered in the form. The short codes do not work in the email body, Body Codes do work. I added a cred_save_data hook but the short codes still won't work.
Is this even possible or do the emails get sent before the post is finalized?

#303467

Thank you for contacting us here in the Support Forum and for providing the Debug Informations

Including info from the created Post in the email notification, should be possible with CRED.

I am not sure what you mean by "The short codes do not work in the email body, Body Codes do work."
Could you elaborate on this?

Perhaps, you could share a example code of your Email-Notification, so I can see what you try to include in that.

Even faster would be if you just export the CRED form in question, and send it to me via Google Drive or Dropbox. I can then upload that to my test install, and see what you are trying to do.

To export CRED forms, you just head to Dashboard > CRED > Forms > your_form and hover with the mouse pointer over the CRED Form in the table listing.

A "Export" link will appear.

Please attach some info about your Custom post type too, so I can quickly re-build the necessary environment.

Please could you provide me the additional Infos?

Thank you

#303509

In the Notification mail body I placed Fields and Views shortcodes like [types field="lead-make"][/types] but they never show any data. Body Codes such as %%FORM_DATA%% do display correctly in the notification email.

I have exported the form
hidden link

The form looks like this while I'm testing the funcionality. I will eventually split this into 2 notifications.

%%FORM_DATA%%
%%DATE_TIME%%
%%POST_ID%%

Year: [types field="lead-year" format="FIELD_VALUE"][/types]
Make: [types field="lead-make"][/types]
Model: [types field="lead-model"][/types]
VIN: [types field="lead-vin"][/types]

Ultimately I will create two notification emails. One human readable and a second email will contain ADF XML code with the field data from the child post created by the form. The XML in the second email will get parsed by a customer management system.

#304041

Thanks for the Details

I am able to reproduce some similar issues, but not all of them.

I am further debugging the issue.

I will update you here ASAP.

Thank you for your patience.

#304183

I am able to (as previously mentioned) replicate this but with other "Views and Fields" Shortcodes, namely the "Author" and any related information.

I'll unfortunately need to troubleshoot this directly on your site if possible.

I would 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

Your next answer will be private which means only you and I have access to it.

?? Please backup your database and website ??

✙ 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
✙ I will need to submit different new Posts using that form, and will temporarily need to change the Email Recipient so I get the notifications.

If this is not possible to do on your life site, please can you send me a site's snapshot?
We usually recommend the free Plugin "Duplicator" for this porpoise.

If you already know how Duplicator works
(http://wordpress.org/plugins/duplicator/),
please skip the following steps and just send me the installer file and the zipped package you downloaded.

★ Duplicator Instructions
hidden link
Send me both files (you probably want to use DropBox, Google Drive, or similar services, as the snapshot file will be quite big)

?? IMPORTANT ??
Remember to create or keep an admin account for me before creating the snapshot, or I won't be able to login. You may delete the new admin account once the snapshot has been built.

I will enable your next answer as private so you can provide me the information securely.

Remember that due to different PHP and Server versions, we might not get the same results using a Site's snapshot, therefore the best would be to work directly on the live site, or at least on a test site on the same server.

I apologize to not be able to help you with easier tools, but it is not possible to me to reproduce this exactly as per your description on my test install without further environments details.

Please could you provide me the additional Infos,
and as well permit me to perform the required steps?

Thank you

#304526

I apologize, I am having trouble accessing your site, Admin or just front-end.

I keep receiving a 403 Error:

Forbidden
You don't have permission to access /wp-login.php on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

I add here my IP in case you need to whitelist it:

IP:

179.24.60.87

I am based in Uruguay in case you have some countries blocked.

Please could you confirm me the additional Infos?

Thank you

#304624

Thanks for the Details

I have been able to reproduce this.

As far I can see you receive all needed data, but only when using the %%FORM_DATA%% code.

If you include fields like [types field="lead-year" format="FIELD_VALUE"][/types], no content is included in the Email.

I must consult this with the 2nd tier Support, and will get back at you ASAP.

Thank you for your patience.

#304847

May I ask for a additional detail.

You mention that you use a cred_sava_data hook.

Would you mind sharing that piece of Code with me?

This to provide our 2nd Tier with as much information as possible.

I will enable another private form, so you can share the code in a secure way with me.

Thank you for your collaboration and patience on this.

#304874

Thanks for the Details

This is what I was going to suggest, to re-save your custom Field on creating the Lead Post, to see if it would help to solve this situation.

The problem is, I see on your site there you are:
a) building parent items (vehicles) with it's custom fields,
b) in your CRED Email, you are retrieving info from custom fields that actually (should) belong to the parent Post type, but I see that you also have the exact same fields in your Child Post Type (Leads).

The point here is, you should try to integrate the "parents" field values, because in the child item, you won't have those values, unless you save them there too when creating the child post (your lead)

Our 2nd Tier supper tis currently analyzing this, but it is possible that we need to adjust the creed_save_data hook to use this correctly in this specific case.

I will now change the status of this ticket to pending development work until I hear back from the 2nd Tier.

Thanks four your patience.

#308814

I have been updated by the 2nd Tier as follows:

1. You seem to not use the CRED child link for creating the Lead post ( your child post ). You are using the direct CRED short code

[cred_form form="Interested Lead"]

This way we are not telling CRED that the current post is the parent and are not setting it.
So it would not be expected to have the Types field rendered as no parent is actually assigned to the post created.

A suggestion to solve this:
- Set a parent-child relationship between the lead and the inventory custom post type.
- use one of CRED's hooks, for example cred_save_data to save this information before it's needed by the notifications

Below you have one possible suggestion considering a CRED form with id=6 and the custom post type that is the parent would have a slug = parent_cpt thus the '_wpcf_belongs_parent_cpt_id' meta key

add_action('cred_save_data', 'otgs_cred_save_data_action', 10, 2);

function otgs_cred_save_data_action($post_id, $form_data){
    //if a specific form
    if (6 == $form_data['id']){
        $parent_id = $form_data['container_id'];
        add_post_meta($post_id, '_wpcf_belongs_parent_cpt_id', $parent_id);
    }
}

2. You seem to not have a parent / children relationship established in the two custom post types considered.

3. The Types fields in the notification email are not correct if they are form the parent post.
(if you have them still set up the below mentioned way):

Year: [types field="year-lead" output="raw" id="$leads"][/types]
Make: [types field="make-lead" id="$vehicle"][/types]
Model: [types field="model-lead" id="$current_page"][/types]
VIN: [types field="vin-lead" id="$post"][/types]

The 'id' which allows to set the parent post type should actually reflect the parent post type,
currently it looks like each one is different. Shouldn't that be id="$vehicle"?
As below:

Year: [types field="year-lead" output="raw" id="$vehicle"][/types]
Make: [types field="make-lead" id="$vehicle"][/types]
Model: [types field="model-lead" id="$vehicle"][/types]
VIN: [types field="vin-lead" id="$vehicle"][/types]

Please don't hesitate to inform me in case the issue persists
and let me know if the above solution works for you, I look forward to your reply!

Thank you

#308911

After your last reply, I rebuilt the CPT and the CRED form and removed any parent child relationship to see if it would work at a more basic level. The notifications still did not return the data I wanted.
After reading the 2nd Tier update I started rethinking my logic. I have dealerships as the parents of inventory and I setup the leads as children of the dealerships because the leads will go to the dealerships and reports would be created by the dealer.
Once I set leads to be the children of inventory everything worked as expected.
I am also using the custom function which was different then what I was using to set the parent.
Thanks for your help