Your answer is not working…. dynamic default value in Ver 2.1.0

Home Forums Quform WordPress Your answer is not working…. dynamic default value in Ver 2.1.0

This topic is: resolved
  • This topic has 4 replies, 3 voices, and was last updated 6 years ago by Ally.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #23904
    pedkbm
    Participant

    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
    Hi

    Sorry 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, 2 months ago by pedkbm.
    #23951
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #23956
    pedkbm
    Participant

    thank you very much. I was solved!!

    #24747
    arna-ud2
    Participant

    Hi,

    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 ?

    #24783
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy