Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strangerstudios/9009466 to your computer and use it in GitHub Desktop.
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)
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