• Firstly, I love Forminator, BTW. Great plugin!

    I use the Forminator API quite extensively with our own backend systems. When using the API, I use the get_entries( $form_id ) function quite often. By default it returns ALL entries from the entire database in DESC order; it’s in DESC order because it shows the last entries first. This is fine and I like the DESC order, but it’s quite resource intensive when returning ALL entries. I would like to restrict the number of returned entries when calling this API function to say, the last 3 entries.

    It would be nice to be able to call the function in a manor similar to this: get_entries( $form_id, $limit=3 ), where $limit is the maximum number of entries I want returned.

    Limiting the number of entries returned would speed up the call and be less resource intensive for those of us that do not need ALL entries returned. If the 2nd parameter is not sent to the get_entries() function, then it could still, by default, return all form entries, as usual.

    I could make these changes myself in the code (it’s not that difficult), but as soon as a Forminator update comes, I’m sure I’d have to change it again. So, with that said, I would like to request that this be added to the source code in future versions.

    Thank you, and again, great plugin! ??

    • This topic was modified 1 year, 9 months ago by nawac. Reason: modified text
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @nawac,

    I hope you are keeping well and thank you for reaching out to us.

    You could try using list_entries( $form_id, $per_page) instead of using get_entries($form_id) to return entries per page.

    I hope that helps. Please feel free to get back to us if you need any clarification.

    Kind Regards,
    Nebu John

    Thread Starter nawac

    (@nawac)

    You could try using list_entries( $form_id, $per_page) instead of using get_entries($form_id) to return entries per page.

    Is the list_entries() function in API documentation? I cannot find it nor did I know it existed.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @nawac

    I checked the documentation and it is missing indeed, I pinged our doc team to include this at https://wpmudev.com/docs/api-plugin-development/forminator-api-docs/

    Best Regards
    Patrick Freitas

    Thread Starter nawac

    (@nawac)

    It is not part of the Forminator_API class therefore, you cannot use it like Forminator_API:list_entries($form_id, $per_page, $page = 0), you will get a critical error.

    However, you can use the list_entries() function if you use the Forminator_Form_Entry_Model class like this: Forminator_Form_Entry_Model::list_entries($form_id, $per_page, $page = 0).

    I’m sure this is why it’s not listed as part of the Forminator_API documentation.

    Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hi @nawac

    I’ve shared this additional info with our team. They will verify if the information related to this class may be included in the Forminator documentation. Since this can take some considerable time to be completed, please let know if you may need additional info besides the function code example:

    $entries = Forminator_Form_Entry_Model::list_entries( $form_id, $per_page, $page = 0 );

    Kind regards

    Luis

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @nawac ,

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

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘API get_entries() Limit Number of Entries Returned’ is closed to new replies.