Skip to content

Instantly share code, notes, and snippets.

View feliciaceballos's full-sized avatar

Felicia Ceballos-Marroquin feliciaceballos

View GitHub Profile
@feliciaceballos
feliciaceballos / wpmu-dev-forminator-submissions-dashboard-widget-04.php
Last active October 29, 2018 21:44
Create the WPMU DEV Forminator Recent Submissions Dashboard Widget, Get Class Instance
<?php
/**
* Get instance
*
* @return Forminator_Submissions_Dash_Widget
*/
public static function get_instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
@feliciaceballos
feliciaceballos / wpmu-dev-forminator-submissions-dashboard-widget-05.php
Last active October 29, 2018 21:44
Create the WPMU DEV Forminator Recent Submissions Dashboard Widget, Construct Method the Register Widget
<?php
/**
* Add prerequisites if needed
*/
public function __construct() {
}
/**
* Register the dashboard widget
*/
@feliciaceballos
feliciaceballos / wpmu-dev-forminator-submissions-dashboard-widget-07.php
Last active October 29, 2018 21:44
Create the WPMU DEV Forminator Recent Submissions Dashboard Widget, Configure Widget Settings
<?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 {
@feliciaceballos
feliciaceballos / wpmu-dev-forminator-submissions-dashboard-widget-08.php
Last active October 29, 2018 21:44
Create the WPMU DEV Forminator Recent Submissions Dashboard Widget, Update Widget Settings
<?php
/**
* Update widget options
*
* @param array $options
*
* @return bool
*/
public function update_options( $options = array() ) {
//Fetch all dashboard widget options from the db...
@feliciaceballos
feliciaceballos / wpmu-dev-forminator-submissions-dashboard-widget-09.php
Last active October 29, 2018 21:43
Create the WPMU DEV Forminator Recent Submissions Dashboard Widget, Get Options
<?php
/**
* Get widget Options
*
* @param array $default
*
* @return array
*/
public function get_options( $default = array() ) {
//Fetch ALL dashboard widget options from the db...
@feliciaceballos
feliciaceballos / wpmu-dev-forminator-submissions-dashboard-widget-10.php
Last active October 29, 2018 21:43
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.' ) );
@feliciaceballos
feliciaceballos / wpmu-dev-forminator-submissions-dashboard-widget-11.php
Last active October 29, 2018 21:43
Create the WPMU DEV Forminator Recent Submissions Dashboard Widget, Formatting Submissions
<?php
/**
* Render Form Submissions table on html widget
*
* @param Forminator_Custom_Form_Model $form
* @param Forminator_Form_Entry_Model[] $entries
*/
public function render_form_submissions( $form, $entries ) {
$field_labels = array();
@feliciaceballos
feliciaceballos / wpmu-dev-forminator-submissions-dashboard-widget-01.php
Last active October 29, 2018 21:35
Create the WPMU DEV Forminator Recent Submissions Dashboard Widget Step 1
<?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
*/
@feliciaceballos
feliciaceballos / wpmu-dev-forminator-recent-entries-dashboard-widget-01.php
Last active October 29, 2018 19:18
Plugin Extension for Forminator to Display Forminator Form Entries in WordPress Dashboard Widget
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
@feliciaceballos
feliciaceballos / wpmu-dev-forminator-recent-entries-dashboard-widget-02.php
Created October 24, 2018 19:44
Plugin Extension for Forminator to Display Forminator Form Entries in WordPress Dashboard Widget
/*
* 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;