Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.