Created
April 16, 2014 15:55
-
-
Save strangerstudios/10898197 to your computer and use it in GitHub Desktop.
Change pmpro_getMemberStartdate to have everyone starting at 6am.
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; | |
//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