Last active
April 14, 2021 19:08
-
-
Save strangerstudios/2d2400f4168c5ac81b78 to your computer and use it in GitHub Desktop.
Add a link to the user's profile to view their Visits, Views and Logins Report
This file contains 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
function my_pmpro_member_profile_login_report_link($user) | |
{ | |
global $current_user; | |
$membership_level_capability = apply_filters("pmpro_edit_member_capability", "manage_options"); | |
if(!current_user_can($membership_level_capability)) | |
return false; | |
if(!function_exists("pmpro_hasMembershipLevel") || (function_exists("pmpro_hasMembershipLevel") && pmpro_hasMembershipLevel(NULL, $user->ID))) | |
{ | |
if(function_exists("pmproblr_init")) | |
$report_slug = "better_login"; | |
else | |
$report_slug = "login"; | |
?> | |
<hr /> | |
<h3><?php _e("Member Visits, Views and Logins Report", "pmpro"); ?></h3> | |
<table class="form-table"> | |
<tr> | |
<th> </th> | |
<td><a href="<?php echo admin_url("admin.php?page=pmpro-reports&report=" . $report_slug . "&s=" . urlencode($user->user_email));?>"><?php _e('View Report for', 'pmpro');?> <?php echo $user->user_email; ?></a></td> | |
</tr> | |
</table> | |
<?php | |
} | |
} | |
add_action('edit_user_profile', 'my_pmpro_member_profile_login_report_link'); | |
add_action('show_user_profile', 'my_pmpro_member_profile_login_report_link'); |
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 "See Details on a Member’s Visits, Views and Logins" at Paid Memberships Pro here: https://www.paidmembershipspro.com/see-details-on-a-members-visits-views-and-logins/