Trying to Export Submissions in INIT function
-
I’ve written a shortcode to test the various Ninja_Forms class functions for submissions.
I’ve been able to get the form spit out the correct submissions and the fields for each submission using:
//Setup Query $args = array( 'form_id' => $form_id, ); $subs = Ninja_Forms()->subs()->get( $args );Here is the expected result, with some information obfuscated:
Array ( [0] => NF_Sub Object ( [sub_id] => 219 [seq_num] => 1 [form_id] => 9 [fields] => Array ( [16] => John [17] => Doe [18] => john@company.com [19] => 555-123-123 [21] => Array ( [0] => Option 1 ) [22] => VEG ) [action] => submit [user_id] => 3 [meta] => Array ( [_seq_num] => 1 [_sub_id] => 219 [_form_id] => 9 [_action] => submit ) [date_submitted] => 2015-08-18 11:28:58 [date_modified] => 2015-08-18 11:28:58 ) )However, this code doesn’t work when running inside the nf_init function, which I presume is the correct link a function that will execute before output is rendered to the browser, BUT after Ninja Forms class and some globals have been initialised. Not the case.
This is the output, which doesn’t contain any fields.
[0] => NF_Sub Object ( [sub_id] => 219 [seq_num] => 1 [form_id] => 9 [fields] => Array ( ) [action] => submit [user_id] => 3 [meta] => Array ( [_seq_num] => 1 [_sub_id] => 219 [_form_id] => 9 [_action] => submit ) [date_submitted] => 2015-08-18 11:28:58 [date_modified] => 2015-08-18 11:28:58 )Does anyone have any ideas why the subs class is not returning all the fields? Am I using the wrong action hook? I thought that all the fields would be initialised inside nf_init?
The topic ‘Trying to Export Submissions in INIT function’ is closed to new replies.