• Resolved mukape

    (@mukape)


    Hello,

    I’m using Ultimate member plugin for user registration, it’s giving me the ability to add a custom field to the user profile

    Now i need to this custom fields in the submisions, which means if user x has submitted a forminator form, I need his data to be displayed in the submission and the csv file even it’s a custom fields made with ultimate member

    • This topic was modified 1 year, 10 months ago by mukape.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hi @mukape

    Hope you are doing fine!

    I have shared this request with our development team. They will review the request and based on how complex the functionality may be, they’ll let know if custom code may be added,

    Keep in mind the team works with more complex issues and their response may take some considerable time. Once they have an update, this thread will be updated accordingly.

    Thanks in advance for your understanding.

    Kind regards

    Luis

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @mukape

    add_action( 'forminator_before_form_render', 'wpmudev_user_data_form_check', 10, 5 );
    function wpmudev_user_data_form_check( $id, $form_type, $post_id, $form_fields, $form_settings ) {
    	if ( 6 == $id ) {
            if ( ! is_user_logged_in() ) {
                return;
            }
    		add_action( 'forminator_before_field_render', 'wpmudev_render_user_data', 10, 1 );
    	}
    }
    
    function wpmudev_render_user_data( $field ) {
        $user_id = get_current_user_id();
        $prefill_key = sanitize_text_field( Forminator_Field::get_property( 'prefill', $field ) );
        if ( ! empty( $prefill_key ) ) {
            $user_meta = get_user_meta( $user_id, $prefill_key, true );
            if ( ! empty( $user_meta ) ) {
                if ( is_array( $user_meta ) ) {
                    $_REQUEST[$prefill_key] = implode( ',', $user_meta );
                } else {
                    $_REQUEST[$prefill_key] = $user_meta;
                }
            }
        }
    }

    You need to change 6 to your form ID. You can find your form ID in page source where form is located, or edit your form in WP Dashboard and URL of that page edit will contain that ID.

    The snippet requires adding a user meta key in the query parameter of the Forminator field like the attached screenshot:

    https://monosnap.com/file/iWjLHezHJZ3VV7rsPoQQzbzW9BWZYV

    Kind Regards,
    Kris

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @mukape ,

    We haven’t heard from you for 4 days now, so it looks like you no longer need our assistance.

    Feel free to re-open this ticket if required.

    Kind regards
    Kasia

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Getting user data/info in the form, from custom fields in Ultimate member plugin’ is closed to new replies.