Home › Toolset Professional Support › [Resolved] CRED Email Notification – Post Body displaying 'Infinite Loop' message
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 |
---|---|---|---|---|---|---|
- | 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 7 replies, has 2 voices.
Last updated by Gavin 4 months, 1 week ago.
Assisted by: Minesh.
I have set up an Email Notification for a CRED Form.
When I insert the Post Body shortcode into the notification I get this message on the received email:
Content not displayed because it produces an infinite loop.
The wpv-post-body shortcode was called more than once with the same attributes over the same context, triggering an infinite loop.
I have tried adding suppressing filters as per:
https://toolset.com/forums/topic/cant-get-post-body-to-show-in-cred-email-notification/
[wpv-post-body view_template="None" suppress_filters="true"]
I have also tried adding %%POST_ID%% as per:
https://toolset.com/course-lesson/send-notifications-when-someone-submits-the-form/
[wpv-post-body item="%%POST_ID%%"]
And every combination, e.g.
[wpv-post-body view_template="None" suppress_filters="true" item="%%POST_ID%%"]
All return the same error message.
Here is a screenshot of the received email.
Hello. Thank you for contacting the Toolset support.
Can I have admin access details and information with what form you configured the email notification and let me review that how you configure it.
*** 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 have set the next reply to private which means only you and I have access to it.
Email received with body looking okay.
When I review the form you are using:
- hidden link
I see you are using the generic field for the post_content field:
<h2 class="text-center mt-3">Message</h2> <div class="text-center"> [cred_generic_field field='post_content' type='textarea' class='' urlparam=''] { "required":1, "validate_format":0, "default":"" } [/cred_generic_field] </div>
So, we have to use custom placeholder in order to display the post_content in email message. For that, I've added the following code to "Custom Code" section offered by Toolset:
=> https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/
add_filter('cred_subject_notification_codes', 'func_post_conent_email_placeholder', 10, 1); add_filter('cred_body_notification_codes', 'func_post_conent_email_placeholder', 10, 1); function func_post_conent_email_placeholder( $defaultPlaceHolders ) { $newPlaceHolders = array( '%%POST_CONTENT%%' => $_REQUEST['post_content'] ); return array_merge($defaultPlaceHolders, $newPlaceHolders ); }
And within the email notification body I've added the placehoder as given under:
<a href="<em><u>hidden link</u></em>"><img src="<em><u>hidden link</u></em>" alt="fab.church" /></a> <h2>[wpv-post-link item="%%POST_ID%%"]</h2> %%POST_CONTENT%% To stop receiving these emails, edit your preferences under 'My Account' in your <a href="<em><u>hidden link</u></em>">profile</a>.
More info:
- https://toolset.com/documentation/programmer-reference/forms/how-to-use-custom-placeholders-in-cred-notifications/
Can you please confirm it works as expected now.
Thank you.
It wasn't working with either the regular WYSIWYG field OR the generic field. I changed it to Generic Field to see if that fixed the issue.
So... I will test if this fix works with both?
Thanks
Gavin
Yes, you can test with both, it should work.
Hi Minesh
Thank you! I changed it back to the standard editor for the field and it appears to be working fine.
I apologise that I did not see this documentation!
Excellent support, as always.
Best Regards
Gavin
Massive thank you to Minesh for excellent support. To be fair, he only had to point me to the correct documentation but he went over and above and demonstrated the fix for me.