Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WordPress - Ninja Forms: How to edit a saved Submission Programatically?

I have a form say Form_ID=9. I want to edit Field_id:50 (lable: status) of a specific submission say Sub_id:160.

I can access that piece of information with custom code on a custom template page (front-end) but couldn't find a way to Update (or edit or modify, whatever you say) a field in a particular submission. Even Ninja Support refused to help.

Any CODE NINJA who could help?

like image 668
Khawar.Y. Avatar asked Nov 30 '25 07:11

Khawar.Y.


1 Answers

Finally figured it out. Please note now I am using Ninja Forms 3.0.2 and this approach is for 3 on-wards (not tested < v3).

This is how to edit a field in as already saved form:

$result = Ninja_Forms()->sub( $sub_id )->update_field( 50, $status );

So for my example above it will become:

$result = Ninja_Forms()->sub( 160 )->update_field( 50, $status ); // 50 is field id and $status is the updated value.

Enjoy..

like image 93
Khawar.Y. Avatar answered Dec 03 '25 00:12

Khawar.Y.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!