Last active
October 29, 2018 21:43
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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