global $wpdb; $query = $wpdb->prepare( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = %d AND meta_value > UNIX_TIMESTAMP( NOW() )", $course_id ); return $wpdb->get_col( $query );