Skip to content

Instantly share code, notes, and snippets.

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/10898197 to your computer and use it in GitHub Desktop.
Save strangerstudios/10898197 to your computer and use it in GitHub Desktop.
Change pmpro_getMemberStartdate to have everyone starting at 6am.
function custom_pmpro_getMemberStartdate($timestamp, $user_id, $level_id)
{
global $wpdb;
//get timestamp
$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);
//convert to 6am
$datetime = date("Y-m-d", $timestamp) . " 06:00";
//convert back to timestamp
$timestamp = strtotime($datetime);
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