Skip Navigation

[Resolved] Customizing the CRED form error message

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

Our next available supporter will start replying to tickets in about 0.73 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: Africa/Casablanca (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by Saul Baizman 3 years ago.

Assisted by: Jamal.

Author
Posts
#2208943
screenshot 2021-10-29 at 12.41.35.png

Hi there,

I was wondering if it were possible to modify the CRED form error message circled in purple in the attached screenshot.

Thanks!

Saul

#2209833

Hello and thank you for contacting Toolset support.

I went through the Toolset Forms code and the message is added on library\toolset\cred\embedded\models\Forms.php
It seems that we can use the gettext hook to customize this message. something like this should work:

add_filter('gettext', function($translated_text, $untranslated_text, $domain){
    if($untranslated_text == 'The post was not saved because of the following problem:' && $domain == 'wp-cred'){
        $translated_text = 'Your custom message here';
    }
    return $translated_text;
}, 10, 3);

Please note that I did not test this code on my own. Let me know if it does not work for you and I'll check it further.

Check this article for more reading about the hook and how to add custom code to Toolset:
- https://developer.wordpress.org/reference/hooks/gettext/
- https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/

#2210283

Jamal, thanks for looking into this. When I was modifying the form in the WP dashboard, I noticed a set of messages that are easily configurable. Unfortunately, I can't attach a screenshot to this reply (feature request!). It's on the post forms edit screen in the section named "Messages." The specific messages I wanted to change were "Post not saved message (one problem)" and "Post not saved message (several problems)." No need for any PHP, it was super easy!

Thanks again.

Saul