---
title: "Login"
id: "10736"
type: "page"
slug: "csa-login-2"
published_at: "2025-04-01T01:21:37+00:00"
modified_at: "2025-04-01T01:32:49+00:00"
url: "https://review.content-science.com/csa-login-2/"
markdown_url: "https://review.content-science.com/csa-login-2.md"
excerpt: "[MM_Form type='login'] [MM_Form_Message type='error'] [MM_Form_Message type='success'] [MM_Form_Button type='login' label='Sign In' class=\"btn btn-danger btn-continue pull-right\"] Forgot your password? [/MM_Form]"
---

# Login

// Check URL parameters to see if we need to store rid var urlParams = new URLSearchParams(window.location.search); if (urlParams.has('checkout_rid')) { var rid = urlParams.get('checkout_rid'); console.log('Found checkout_rid parameter:', rid); // Store in cookie document.cookie = "checkout_rid=" + rid + "; path=/; max-age=3600"; }

// Function to get checkout URL with rid parameter if it exists function getCheckoutUrl() { var baseUrl = '/checkout'; // Check if we have the rid cookie var ridMatch = document.cookie.match(/checkout_rid=([^;]+)/); if (ridMatch) { return baseUrl + '?rid=' + ridMatch[1]; } return baseUrl; }

// Watch for successful AJAX login $(document).ajaxSuccess(function(event, xhr, settings) { // Check if this is the MM login AJAX request if (settings.url && settings.url.indexOf('mm_login') !== -1) { try { // Parse the AJAX response var response = JSON.parse(xhr.responseText); console.log('MM Login Response:', response);

if (response && response.type === 'success') { console.log('Login successful! Forcing redirect to checkout...');

// Force redirection to checkout with rid parameter if available window.location.href = getCheckoutUrl(); } } catch (e) { console.error('Error parsing AJAX response:', e); } } });

// Also monitor for errors and fix those $(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) { // Check if this is the AJAX login request if (ajaxSettings.url && ajaxSettings.url.indexOf('mm_login') !== -1) { console.log('AJAX error detected on mm_login. Checking login status...');

// Check if the user is actually logged in despite the error $.ajax({ url: '/wp-admin/admin-ajax.php', type: 'GET', data: { action: 'is_user_logged_in_check' }, success: function(response) { if (response === 'yes') { console.log('User is logged in despite AJAX error! Redirecting to checkout...'); window.location.href = getCheckoutUrl(); } } }); } }); }); });
