How can I prepare a list so that the members are saved to the ninja form in wordpress and can only be seen in their own accounts?

Viewed 33

The point I have reached so far:

    foreach( array_reverse( $subs ) as $sub ){

            if( wp_get_current_user()->user_email == $sub->get_field_value( 'email' ) ){
                $merge_tags = Ninja_Forms()->merge_tags[ 'fields' ];
                foreach( $fields as $field ){
                    $field_id = $field->get_id();
                    $merge_tags->add_field( array(
                        'id' => $field->get_id(),
                        'key' => $field->get_setting( 'key' ),
                        'type' => $field->get_type(),
                        'value' => $sub->get_field_value( $field_id )
                    ));
                }
//                echo $merge_tags->replace( $form->get_setting( 'id' ) );
                print_r($merge_tags);
            } else {echo "not working";}
        }

My foreach loop does not work because the registered user and the mail registered in ninja form do not match

1 Answers

I fixed this problem. I took to data from db. First i used this filter: 'ninja_forms_submit_data'

I caught it with var_dump while sending the data and I created an array with foreach and saved this arrray to the user meta. Thus, I was able to pull the data wherever I wanted by creating a shortcode according to the user.

Related