Last active
August 29, 2015 13:56
-
-
Save strangerstudios/9009466 to your computer and use it in GitHub Desktop.
Filter the pmpro_getMemberStartdate() function in Paid Memberships Pro. (Requires PMPro v1.7.8 or higher)
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 custom_pmpro_getMemberStartdate($timestamp, $user_id, $level_id) | |
{ | |
global $wpdb; | |
if(!empty($level_id)) | |
$sqlQuery = "SELECT UNIX_TIMESTAMP(startdate) FROM $wpdb->pmpro_memberships_users WHERE membership_id IN(" . esc_sql($level_id) . ") AND user_id = '" . esc_sql($user_id) . "' ORDER BY id LIMIT 1"; | |
else | |
$sqlQuery = "SELECT UNIX_TIMESTAMP(startdate) FROM $wpdb->pmpro_memberships_users WHERE user_id = '" . esc_sql($user_id) . "' ORDER BY id LIMIT 1"; | |
$timestamp = $wpdb->get_var($sqlQuery); | |
return $timestamp; | |
} | |
add_action('pmpro_member_startdate','custom_pmpro_getMemberStartdate', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment