Title: Trying to Export Submissions in INIT function
Last modified: August 30, 2016

---

# Trying to Export Submissions in INIT function

 *  [John Brand](https://wordpress.org/support/users/brandbrilliance/)
 * (@brandbrilliance)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/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?
 * [https://wordpress.org/plugins/ninja-forms/](https://wordpress.org/plugins/ninja-forms/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [John Brand](https://wordpress.org/support/users/brandbrilliance/)
 * (@brandbrilliance)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/trying-to-export-submissions-in-init-function/#post-6450710)
 * I figured out the issue using trial and error. I adjusted the init function back
   to init (not nf_init) and made the priority 999 to ensure all the register fields
   happen.
 *     ```
       add_action('init', 'ninja_forms_export_init', 999);
       ```
   
 * Then it works.

Viewing 1 replies (of 1 total)

The topic ‘Trying to Export Submissions in INIT function’ is closed to new replies.

 * ![](https://ps.w.org/ninja-forms/assets/icon-256x256.png?rev=1649747)
 * [Ninja Forms - The Contact Form Builder That Grows With You](https://wordpress.org/plugins/ninja-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ninja-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ninja-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/ninja-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ninja-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ninja-forms/reviews/)

## Tags

 * [submissions](https://wordpress.org/support/topic-tag/submissions/)

 * 1 reply
 * 1 participant
 * Last reply from: [John Brand](https://wordpress.org/support/users/brandbrilliance/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/trying-to-export-submissions-in-init-function/#post-6450710)
 * Status: not resolved