Skip Navigation

[Resolved] Customizing error message on CRED form

This support ticket is created 2 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.54 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by Saul Baizman 2 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#2475557
screenshot 2022-10-13 at 10.07.30.png

Hi there,

I created a CRED form that allows logged in users to change their password. I embedded this form on a page with the permalink /change-password/. If a visitor visits this page when logged out (not likely, but it could happen), the form doesn't display, and instead the message "No user specified" appears. See the attached screenshot.

My question: can I customize this message? Or quell it (through PHP, not CSS)?

Thanks.

Saul

#2475881

Hello,

It is possible with gettext filter, for example:

add_filter('gettext', function($translated_text, $untranslated_text, $domain){
    if($untranslated_text == 'No user specified' && $domain == 'wp-cred'){
        $translated_text = 'My No user specified message';
    }
    return $translated_text;
}, 10, 3);

More help:
https://developer.wordpress.org/reference/hooks/gettext/

#2476391

This is exactly what I was looking for. Thank you, Luo!

Saul