Forked from andrewlimaza/my_custom_dashboards.php
Last active
April 14, 2022 03:37
-
-
Save strangerstudios/bdf87c248a7ec159cfa352edae8cfa41 to your computer and use it in GitHub Desktop.
Show Membership Reports on the WordPress Admin Dashboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>'; | |
} |
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
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/