Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Last active February 19, 2019 23:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andrewlimaza/ce8b09240cc65556e375a489650526d7 to your computer and use it in GitHub Desktop.
Save andrewlimaza/ce8b09240cc65556e375a489650526d7 to your computer and use it in GitHub Desktop.
Show 'report' widgets within the admin dashboard
<?php
//Copy the code below into your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
function add_my_report_dashboard(){
if( ! defined( 'PMPRO_DIR' ) || ! current_user_can( 'manage_options' ) ){
return;
}
wp_add_dashboard_widget(
'pmpro_membership_dashboard', // Widget slug.
__( 'Paid Membership Pro Report' , 'pmpro' ), // Title.
'my_pmpro_dashboard_report' // Display function.
);
}
add_action( 'wp_dashboard_setup', 'add_my_report_dashboard' );
function my_pmpro_dashboard_report(){
//include report pages
require_once( PMPRO_DIR . '/adminpages/reports/login.php' );
require_once( PMPRO_DIR . '/adminpages/reports/memberships.php' );
require_once( PMPRO_DIR . '/adminpages/reports/sales.php' );
//show login report
echo '<br/><h3>' . __( 'Visit, Views and Logins', 'pmpro' ) . '</h3>';
pmpro_report_login_widget();
//show membership report
echo '<br/><h3>' . __( 'Membership Stats', 'pmpro' ) . '</h3>';
pmpro_report_memberships_widget();
//show sales report
echo '<br/><h3>' . __( 'Sales and Revenue', 'pmpro' ) . '</h3>';
pmpro_report_sales_widget();
echo '<br/><a href="' . admin_url( 'admin.php?page=pmpro-reports' ) . '">' . __( 'View All Reports', 'pmpro' ) . '</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment