Skip Navigation

[Resolved] Display form values within the message after submitting the form

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to display user field value in CRED Add New User form >> Message, to display after form submission?

Solution:
1. Add this code in your theme’s or child theme’s functions.php file:

function get_user_id() {
  
    if(isset($_GET['_target']) && $_GET['_target'] != ''){
  return intval($_GET['_target']);
 }
 else
  return 0;
}
add_shortcode( 'get_user_id', 'get_user_id' );

2. Register the ‘get_user_id’ shortcode first in Toolset >> Settings >> Front-end Content >> Third-party shortcode arguments.

3. Then add shortcode like this in CRED User form >> Message to display:

[wpv-user field="user_email" id="[get_user_id]"] 
This support ticket is created 7 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.

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
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 9 replies, has 2 voices.

Last updated by Noman 7 years, 3 months ago.

Assisted by: Noman.

Author
Posts
#558133
2017-08-09_12h31_28.png

In my cred-form i choose "Display a messyge instead of the form...".
I inserted some html-text as the success-message.
Now how could i show an input value of the submitted form in the following html-message? See screen?
body-codes, %%user_username%% for example, don´t work unfortunatelly.
Thanks in advance.

#558180

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Fields and Views shortcodes.png

Hi Mario,

Thank you for contacting Toolset support. Under section "After visitors submit this form:" >> you can use "Fields and Views" button >> there you will see all shortcodes you can insert and use in the cred form Success message, for example I have checked this one:

 [wpv-user field="nickname"] 

Please see attached screenshot.

Thank you

#558205

thanks Noman.

Lets say my cred-form has a text-input field with the name 'key'.
In the message i want to show the inputed value, something like
%%key%% or [wpv-post-param name='key']
How can i get the posted/submitted values into the message in this case? (Pretty much the same as it is with email-notifications).

#558249

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Anything that is like %%key%% are the Email Tags and can only be used for Email message notifications, they are not supposed to work as website content or in message.

I suppose, by text-input field you mean to say Custom field (Single line text field), if that’s the case then you can add it using Fields and Views button, I have created a short video for you:
hidden link

Thanks

#558283

Thank you so much Noman. Great support.
It works for post-forms, but not for user-forms.

To be more precise: The cred-form is a user-registration form, that creates a new user. So the form-values for example are login_name and user_email.
In the "Display a message instead...." i want to show this inserted values.

Unfortunatelly shortcodes for [wpv-user...] always are valid for the current logged in user or for a specific User-ID, that i don´t have at this moment.

#558294

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for the compliments 🙂 Would it be possible for you to provide temporary site WP admin login so I can test it with exact same settings as you have.

If so, please also provide temporary website WP-admin info for your site so I can see your setup. 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-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.

✙ Please add the Links to the [CRED Form] Edit Screen and [Page link, etc] where we can see the issue.

Thanks

#558521

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for providing login info and links. I am going to debug this further and update you with my findings.

Thanks

#558590

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I have checked and confirmed that wpv-user shortcodes can not work for newly created user because they don’t get id for the new registered user.

I have achieved the required result using some custom code, please check here now:
hidden link

1. I have added this code in your theme’s or child theme’s functions.php file:

function get_user_id() {
 
    if(isset($_GET['_target']) && $_GET['_target'] != ''){
  return intval($_GET['_target']);
 }
 else
  return 0;
}
add_shortcode( 'get_user_id', 'get_user_id' );

2. Registered the ‘get_user_id’ shortcode first in Toolset >> Settings >> Front-end Content >> Third-party shortcode arguments.

3. Then added this shortcode in CRED User form >> Message to display

 [wpv-user field="user_email" id="[get_user_id]"] 

Thank you

#558714

Works. Thumbs up, Noman. Thank you so much.
I haven´t seen the userid as _target-parameter in the url.

#558718

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Great to hear that issue is resolved now 🙂 We are happy to help you, have a great day.

Thanks for the feedback.