Home › Forums › Quform WordPress › Your answer is not working…. dynamic default value in Ver 2.1.0
- This topic has 4 replies, 3 voices, and was last updated 6 years, 1 month ago by Ally.
- AuthorPosts
- January 17, 2018 at 9:31 am #23904pedkbmParticipant
Hi,
I used a form created with QuForm(1.x) in a page accessible only to registered users.
After 2.1.0 update, I cann’t use user information at dynamic default value.I need that the form send me user information about name and surname etc(wp-members fields).
Now settings Quform only allow me to have the user username and email address (hidden field).
Can you help me?
Thanks a lot,
———————————————————-Quform 1.x
Add this code to your theme functions.php or create a plugin for it:function my_user_firstname($value)
{
return iphorm_get_current_userinfo(‘user_firstname’);
}
add_filter(‘iphorm_element_value_firstname’, ‘my_user_firstname’);function my_user_lastname($value)
{
return iphorm_get_current_userinfo(‘user_lastname’);
}
add_filter(‘iphorm_element_value_lastname’, ‘my_user_lastname’);Add a Hidden field to the form, and in the Settings for it tick “Dynamic default value” and enter the Parameter Name: firstname
Add another Hidden field to the form, and in the Settings for it tick “Dynamic default value” and enter the Parameter Name: lastname
Regards
————————————————-Ally
Support Staff
HiSorry about the delay. The new code is this:
function my_user_firstname($value)
{
$user = wp_get_current_user();if ($user && $user->ID > 0) {
$value = $user->first_name;
}return $value;
}
add_filter(‘quform_element_value_firstname’, ‘my_user_firstname’);function my_user_lastname($value)
{
$user = wp_get_current_user();if ($user && $user->ID > 0) {
$value = $user->last_name;
}return $value;
}
add_filter(‘quform_element_value_lastname’, ‘my_user_lastname’);
Regards
Ally——————————-
===> Above setting is not working. site show me error.!!!
- This topic was modified 6 years, 3 months ago by pedkbm.
January 19, 2018 at 10:55 am #23951AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
January 19, 2018 at 4:04 pm #23956pedkbmParticipantthank you very much. I was solved!!
March 20, 2018 at 11:17 am #24747arna-ud2ParticipantHi,
i make a plugin for that, and it work (as you explain in other topic). But:
1- it not work in the default “double field” first name/last name. In text field no problem.
2 – and for this plugin i have error message display on the backend and php line in the header frontend.
Here is the copy of the backend alert:
Warning: Cannot modify header information – headers already sent by (output started at /homepages/…/wp-admin/includes/misc.php on line 1114
Warning: Cannot modify header information – headers already sent by (output started at /homepages/…/wp-includes/option.php on line 919
Warning: Cannot modify header information – headers already sent by (output started at /homepages/…/wp-includes/option.php on line 920
Can you advise me ?
March 23, 2018 at 2:36 pm #24783AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.