function ym_wp_login($user_login, $user)
{
    global $ym_user, $ym_sys;
    if (!$ym_user) {
        $ym_user = new YourMember_User($user->data->ID);
    }
    $firstlogin = false;
    if (!get_user_meta($user->data->ID, 'ym_user_last_login')) {
        $firstlogin = true;
    }
    $ym_user->is_logging_in();
    $redirect_to = FALSE;
    // Priority One: Request Redirect
    if (isset($_REQUEST['redirect_to']) && $_REQUEST['redirect_to']) {
        $redirect_to = $_REQUEST['redirect_to'];
    }
    //Sneaky not normal redirect
    if ($firstlogin) {
        $pack = ym_get_pack_by_id($ym_user->pack_id);
        if ($pack['login_redirect_url']) {
            $redirect_to = site_url($pack['first_login']);
        }
    }
    // Priority Two: Pack Login Redirect
    if (!$redirect_to && isset($ym_user->pack_id) && $ym_user->pack_id) {
        $pack = ym_get_pack_by_id($ym_user->pack_id);
        if ($pack['login_redirect_url']) {
            $redirect_to = site_url($pack['login_redirect_url']);
        }
    }
    // Priority Three: Default
    if (!$redirect_to && $ym_sys->login_redirect_url) {
        $redirect_to = site_url($ym_sys->login_redirect_url);
    }
    if ($redirect_to) {
        if (!headers_sent()) {
            header('Location: ' . $redirect_to);
        } else {
            echo '<script>window.location="' . $redirect_to . '";</script>';
        }
        exit;
    }
    // Priority Four: WP-Admin
}