Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strangerstudios/bdf87c248a7ec159cfa352edae8cfa41 to your computer and use it in GitHub Desktop.
Save strangerstudios/bdf87c248a7ec159cfa352edae8cfa41 to your computer and use it in GitHub Desktop.
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>';
}
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Show Members Reports on the WordPress Admin Dashboard" at Paid Memberships Pro here: https://www.paidmembershipspro.com/show-members-reports-wordpress-admin-dashboard/

@Aaraninfinitysoft
Copy link

How can we overwrite the adminpages/reports/memberships.php in my child theme?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment