Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Show Membership Reports on the WordPress Admin Dashboard
<?php
/*
Show Members Reports on the WordPress Admin Dashboard.
Update the my_pmpro_dashboard_report() function to remove or add core or custom reports.
*/
//Create a Dashboard Reports widget for Paid Memberships Pro
function add_my_report_dashboard() {
if( ! defined( 'PMPRO_DIR' ) || ! current_user_can( 'manage_options' ) )
{
return;
}
wp_add_dashboard_widget(
'pmpro_membership_dashboard',
__( 'Paid Membership Pro Reports' , 'pmpro' ),
'my_pmpro_dashboard_report'
);
}
add_action( 'wp_dashboard_setup', 'add_my_report_dashboard' );
//Callback function for the widget
function my_pmpro_dashboard_report() {
//included 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 Visits/Views/Logins report
echo '<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 and Revenue report
echo '<br /><h3>' . __( 'Sales and Revenue', 'pmpro' ) . '</h3>';
pmpro_report_sales_widget();
//show link to all PMPro reports
echo '<p style="text-align: center;"><a class="button-primary" href="' . admin_url( 'admin.php?page=pmpro-reports' ) . '">' . __( 'View All Reports', 'pmpro' ) . '</a></p>';
}
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.