Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feliciaceballos/2f624480167e30b4b9b07792eab8d365 to your computer and use it in GitHub Desktop.
Save feliciaceballos/2f624480167e30b4b9b07792eab8d365 to your computer and use it in GitHub Desktop.
Create the WPMU DEV Forminator Recent Submissions Dashboard Widget, Using Forminator API to Get Submissions
<?php
/**
* Get Form detail and its submissions
*
* @return bool
*/
protected function get_submissions() {
// Check if we have configured form ID
if ( empty( $this->id ) ) {
echo esc_html( __( 'Please configure which form to display its submissions.' ) );
return false;
}
$module = null;
$entries = array();
/**
* Call Forminator_API to get form details
*/
$module = Forminator_API::get_form( $this->id );
// Check if form loaded successfully
if ( is_wp_error( $module ) ) {
$module = null;
} else {
/**
* Call Forminator_API to get form entries
*/
$entries = Forminator_API::get_form_entries( $module->id );
}
// Render submissions table
$this->render_form_submissions( $module, $entries );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment