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 | |
/** | |
* Configure Widget | |
* Configure form id and entries limit | |
*/ | |
public function configure() { | |
// Check if user allowed to view the widget | |
if ( ! $this->user_allowed() ) { | |
echo esc_html( __( 'You are not allowed to view this widget content' ) ); | |
} else { |
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 | |
/** | |
* Setup permissions here if needed | |
* | |
* @return bool | |
*/ | |
public function user_allowed() { | |
return true; | |
} |
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 | |
/** | |
* Add prerequisites if needed | |
*/ | |
public function __construct() { | |
} | |
/** | |
* Register the dashboard widget | |
*/ |
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 instance | |
* | |
* @return Forminator_Submissions_Dash_Widget | |
*/ | |
public static function get_instance() { | |
if ( is_null( self::$instance ) ) { | |
self::$instance = new self(); | |
} |
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 | |
/** | |
* Class Forminator_Submissions_Dash_Widget. | |
* | |
*/ | |
class Forminator_Submissions_Dash_Widget { | |
/** | |
* Class instance | |
* |
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 | |
function forminator_dash_widget() { | |
// Widget should be added after `wp_dashboard_setup` hook called. | |
add_action( 'wp_dashboard_setup', 'add_forminator_dash_widget' ); | |
} | |
function add_forminator_dash_widget() { | |
// Instantiate Forminator_Submissions_Dash_Widget class. | |
$widget = Forminator_Submissions_Dash_Widget::get_instance(); | |
$widget->register_widget(); |
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 | |
/** | |
* Plugin Name: Forminator Dashboard Widget | |
* Version: 1.0 | |
* Plugin URI: https://premium.wpmudev.org/project/forminator/ | |
* Description: Display latest form submissions as Dashboard Widget | |
* Author: WPMU DEV | |
* Author URI: http://premium.wpmudev.org | |
*/ |
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 | |
/* | |
Plugin Name: Forminator Recent Entries Dashboard Widget | |
Plugin URI: https://premium.wpmudev.org/project/forminator-pro/ | |
Description: Display Forminator Form Entries in WordPress Dashboard Widget | |
Version: 0.1 | |
Author: Cvetan Cvetanov | |
Author URI: https://premium.wpmudev.org/profile/cvetan | |
*/ |
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
class Forminator_Submissions_Dash_Widget { | |
private static $instance = null; // Here we store class instance | |
private $id = null; // Form ID that we will retrieve submissions from | |
private $limit = 5; // Number of displayed submissions in widget | |
public function __construct() { | |
// Construct method |
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
/* | |
* Get class instance | |
* We will need that to instantiate our plugin class | |
*/ | |
public static function get_instance() { | |
if ( is_null( self::$instance ) ) { | |
self::$instance = new self(); | |
} | |
return self::$instance; |