{"id":11818,"date":"2025-12-23T14:39:00","date_gmt":"2025-12-23T19:39:00","guid":{"rendered":"https:\/\/feelthevibe.fit\/?page_id=11818"},"modified":"2025-12-23T15:09:19","modified_gmt":"2025-12-23T20:09:19","slug":"register","status":"publish","type":"page","link":"https:\/\/feelthevibe.fit\/es\/register\/","title":{"rendered":"Registro"},"content":{"rendered":"\t\t<div class=\"ac-registration-wrapper\">\n\t\t\t\t\t<style>\n\t\t.ac-registration-wrapper { max-width: 480px; margin: 0 auto; padding: 20px; }\n\t\t.ac-registration-form { background: #fff; padding: 30px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }\n\t\t.ac-reg-row { margin-bottom: 20px; }\n\t\t.ac-reg-row label { display: block; font-weight: 600; margin-bottom: 6px; color: #333; font-size: 14px; }\n\t\t.ac-reg-row label .required { color: #e53935; }\n\t\t.ac-reg-row label .optional { font-weight: 400; color: #888; font-size: 12px; }\n\t\t.ac-reg-row input[type=\"text\"],\n\t\t.ac-reg-row input[type=\"email\"],\n\t\t.ac-reg-row input[type=\"password\"] {\n\t\t\twidth: 100%; padding: 12px 14px; border: 1px solid #ddd; border-radius: 8px;\n\t\t\tfont-size: 15px; transition: border-color 0.2s, box-shadow 0.2s;\n\t\t}\n\t\t.ac-reg-row input:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,0.1); outline: none; }\n\t\t.ac-sponsor-input-wrapper { position: relative; }\n\t\t.ac-sponsor-status { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 18px; }\n\t\t.ac-hint { display: block; margin-top: 4px; color: #888; font-size: 12px; }\n\t\t.ac-reg-button {\n\t\t\twidth: 100%; padding: 14px; background: linear-gradient(135deg, #4f46e5, #7c3aed);\n\t\t\tcolor: #fff; border: none; border-radius: 8px; font-size: 16px; font-weight: 600;\n\t\t\tcursor: pointer; transition: transform 0.2s, box-shadow 0.2s;\n\t\t}\n\t\t.ac-reg-button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(79,70,229,0.3); }\n\t\t.ac-reg-button:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }\n\t\t.ac-reg-footer { text-align: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid #eee; }\n\t\t.ac-reg-footer a { color: #4f46e5; text-decoration: none; font-weight: 500; }\n\t\t.ac-reg-messages { margin-bottom: 15px; }\n\t\t.ac-reg-notice { padding: 12px 16px; border-radius: 8px; margin-bottom: 15px; }\n\t\t.ac-reg-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }\n\t\t.ac-reg-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }\n\t\t.ac-reg-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }\n\t\t@media (max-width: 480px) {\n\t\t\t.ac-registration-wrapper { padding: 10px; }\n\t\t\t.ac-registration-form { padding: 20px; }\n\t\t}\n\t\t<\/style>\n\t\t\n\t\t\t<form id=\"ac-registration-form\" class=\"ac-registration-form\" method=\"post\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"ac_register_user\">\n\t\t\t\t<input type=\"hidden\" name=\"ac_reg_nonce\" value=\"bfdfb3a781\">\n\n\t\t\t\t<div class=\"ac-reg-row\">\n\t\t\t\t\t<label for=\"ac_reg_first_name\">First Name <span class=\"required\">*<\/span><\/label>\n\t\t\t\t\t<input type=\"text\" id=\"ac_reg_first_name\" name=\"first_name\" required autocomplete=\"given-name\">\n\t\t\t\t<\/div>\n\n\t\t\t\t<div class=\"ac-reg-row\">\n\t\t\t\t\t<label for=\"ac_reg_last_name\">Last Name <span class=\"required\">*<\/span><\/label>\n\t\t\t\t\t<input type=\"text\" id=\"ac_reg_last_name\" name=\"last_name\" required autocomplete=\"family-name\">\n\t\t\t\t<\/div>\n\n\t\t\t\t<div class=\"ac-reg-row\">\n\t\t\t\t\t<label for=\"ac_reg_email\">Email <span class=\"required\">*<\/span><\/label>\n\t\t\t\t\t<input type=\"email\" id=\"ac_reg_email\" name=\"email\" required autocomplete=\"email\">\n\t\t\t\t<\/div>\n\n\t\t\t\t<div class=\"ac-reg-row\">\n\t\t\t\t\t<label for=\"ac_reg_password\">Password <span class=\"required\">*<\/span><\/label>\n\t\t\t\t\t<input type=\"password\" id=\"ac_reg_password\" name=\"password\" required minlength=\"6\" autocomplete=\"new-password\">\n\t\t\t\t<\/div>\n\n\t\t\t\t<div class=\"ac-reg-row\">\n\t\t\t\t\t<label for=\"ac_reg_password_confirm\">Confirm Password <span class=\"required\">*<\/span><\/label>\n\t\t\t\t\t<input type=\"password\" id=\"ac_reg_password_confirm\" name=\"password_confirm\" required minlength=\"6\" autocomplete=\"new-password\">\n\t\t\t\t<\/div>\n\n\t\t\t\t<div class=\"ac-reg-row ac-sponsor-row\">\n\t\t\t\t\t<label for=\"ac_reg_sponsor_code\">\n\t\t\t\t\t\tInfluencer Code\t\t\t\t\t\t<span class=\"optional\">(optional)<\/span>\n\t\t\t\t\t<\/label>\n\t\t\t\t\t<div class=\"ac-sponsor-input-wrapper\">\n\t\t\t\t\t\t<input type=\"text\" id=\"ac_reg_sponsor_code\" name=\"sponsor_code\" maxlength=\"12\"\n\t\t\t\t\t\t\t   placeholder=\"e.g., JOHNFIT\"\n\t\t\t\t\t\t\t   value=\"\"\n\t\t\t\t\t\t\t   autocomplete=\"off\">\n\t\t\t\t\t\t<span id=\"ac_sponsor_status\" class=\"ac-sponsor-status\"><\/span>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<small class=\"ac-hint\">Enter your influencer&#039;s code if you have one.<\/small>\n\t\t\t\t<\/div>\n\n\t\t\t\t<div id=\"ac_reg_messages\" class=\"ac-reg-messages\"><\/div>\n\n\t\t\t\t<div class=\"ac-reg-row ac-reg-submit\">\n\t\t\t\t\t<button type=\"submit\" id=\"ac_reg_submit\" class=\"ac-reg-button\">\n\t\t\t\t\t\tCreate Account\t\t\t\t\t<\/button>\n\t\t\t\t<\/div>\n\n\t\t\t\t<div class=\"ac-reg-footer\">\n\t\t\t\t\t<p>Already have an account?\t\t\t\t\t\t<a href=\"https:\/\/feelthevibe.fit\/login\/\">\n\t\t\t\t\t\t\tLog in here\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/p>\n\t\t\t\t<\/div>\n\t\t\t<\/form>\n\n\t\t\t\t\t<script>\n\t\t(function() {\n\t\t\tconst form = document.getElementById('ac-registration-form');\n\t\t\tconst submitBtn = document.getElementById('ac_reg_submit');\n\t\t\tconst messages = document.getElementById('ac_reg_messages');\n\t\t\tconst sponsorInput = document.getElementById('ac_reg_sponsor_code');\n\t\t\tconst sponsorStatus = document.getElementById('ac_sponsor_status');\n\n\t\t\t\/\/ Track sponsor validation state\n\t\t\tlet sponsorValidationState = {\n\t\t\t\tcode: '',\n\t\t\t\tisValid: null,      \/\/ null = not validated, true = valid, false = invalid\n\t\t\t\tisValidating: false\n\t\t\t};\n\n\t\t\t\/\/ Validate sponsor code on input (when user types)\n\t\t\tlet sponsorTimeout;\n\t\t\tsponsorInput.addEventListener('input', function() {\n\t\t\t\tclearTimeout(sponsorTimeout);\n\t\t\t\tconst code = this.value.trim().toUpperCase();\n\t\t\t\tthis.value = code; \/\/ Force uppercase\n\n\t\t\t\t\/\/ Reset validation state when code changes\n\t\t\t\tif (code !== sponsorValidationState.code) {\n\t\t\t\t\tsponsorValidationState = { code: '', isValid: null, isValidating: false };\n\t\t\t\t\tsponsorStatus.textContent = '';\n\t\t\t\t\tsponsorInput.style.borderColor = '';\n\t\t\t\t}\n\n\t\t\t\tif (code.length >= 3) {\n\t\t\t\t\tsponsorTimeout = setTimeout(() => validateSponsor(code), 500);\n\t\t\t\t} else if (code.length === 0) {\n\t\t\t\t\t\/\/ Empty is valid (optional field)\n\t\t\t\t\tsponsorValidationState = { code: '', isValid: true, isValidating: false };\n\t\t\t\t\tsponsorStatus.textContent = '';\n\t\t\t\t\tsponsorInput.style.borderColor = '';\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t\/\/ Also validate on blur (in case user pastes and leaves)\n\t\t\tsponsorInput.addEventListener('blur', function() {\n\t\t\t\tconst code = this.value.trim().toUpperCase();\n\t\t\t\tif (code.length >= 3 && sponsorValidationState.code !== code) {\n\t\t\t\t\tvalidateSponsor(code);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t\/**\n\t\t\t * Validate sponsor code via AJAX\n\t\t\t * Returns a Promise for async\/await usage\n\t\t\t *\/\n\t\t\tfunction validateSponsor(code) {\n\t\t\t\treturn new Promise((resolve) => {\n\t\t\t\t\tsponsorValidationState.isValidating = true;\n\t\t\t\t\tsponsorStatus.textContent = '\u23f3';\n\t\t\t\t\tsponsorInput.style.borderColor = '#f59e0b'; \/\/ Orange while validating\n\n\t\t\t\t\tfetch('https:\/\/feelthevibe.fit\/wp-admin\/admin-ajax.php', {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: { 'Content-Type': 'application\/x-www-form-urlencoded' },\n\t\t\t\t\t\tbody: 'action=ac_validate_sponsor_registration&sponsor_code=' + encodeURIComponent(code)\n\t\t\t\t\t})\n\t\t\t\t\t.then(r => r.json())\n\t\t\t\t\t.then(data => {\n\t\t\t\t\t\tconst isValid = data.success === true;\n\t\t\t\t\t\tsponsorValidationState = {\n\t\t\t\t\t\t\tcode: code,\n\t\t\t\t\t\t\tisValid: isValid,\n\t\t\t\t\t\t\tisValidating: false\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsponsorStatus.textContent = isValid ? '\u2705' : '\u274c';\n\t\t\t\t\t\tsponsorInput.style.borderColor = isValid ? '#16a34a' : '#dc2626';\n\n\t\t\t\t\t\tif (!isValid) {\n\t\t\t\t\t\t\tconsole.warn('AC Registration: Sponsor code \"' + code + '\" validation failed');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresolve(isValid);\n\t\t\t\t\t})\n\t\t\t\t\t.catch((err) => {\n\t\t\t\t\t\tconsole.error('AC Registration: Sponsor validation error', err);\n\t\t\t\t\t\tsponsorValidationState = { code: code, isValid: null, isValidating: false };\n\t\t\t\t\t\tsponsorStatus.textContent = '\u26a0\ufe0f';\n\t\t\t\t\t\tsponsorInput.style.borderColor = '#f59e0b';\n\t\t\t\t\t\tresolve(null); \/\/ Unknown state\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t\/**\n\t\t\t * AUTO-VALIDATE: If sponsor code is pre-filled (from URL or cookie), validate immediately\n\t\t\t *\/\n\t\t\t(function autoValidatePrefilled() {\n\t\t\t\tconst prefilledCode = sponsorInput.value.trim().toUpperCase();\n\t\t\t\tif (prefilledCode.length >= 3) {\n\t\t\t\t\tconsole.log('AC Registration: Auto-validating pre-filled sponsor code: ' + prefilledCode);\n\t\t\t\t\tvalidateSponsor(prefilledCode);\n\t\t\t\t} else if (prefilledCode.length === 0) {\n\t\t\t\t\t\/\/ No code = valid (optional)\n\t\t\t\t\tsponsorValidationState = { code: '', isValid: true, isValidating: false };\n\t\t\t\t}\n\t\t\t})();\n\n\t\t\t\/\/ Form submission with sponsor validation\n\t\t\tform.addEventListener('submit', async function(e) {\n\t\t\t\te.preventDefault();\n\t\t\t\tmessages.innerHTML = '';\n\n\t\t\t\t\/\/ Validate passwords match\n\t\t\t\tconst pass = document.getElementById('ac_reg_password').value;\n\t\t\t\tconst passConfirm = document.getElementById('ac_reg_password_confirm').value;\n\t\t\t\tif (pass !== passConfirm) {\n\t\t\t\t\tshowMessage('Passwords do not match.', 'error');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst sponsorCode = sponsorInput.value.trim().toUpperCase();\n\n\t\t\t\t\/\/ If there's a sponsor code, ensure it's validated before submitting\n\t\t\t\tif (sponsorCode.length >= 3) {\n\t\t\t\t\t\/\/ Check if we need to (re)validate\n\t\t\t\t\tif (sponsorValidationState.code !== sponsorCode || sponsorValidationState.isValid === null) {\n\t\t\t\t\t\tsubmitBtn.disabled = true;\n\t\t\t\t\t\tsubmitBtn.textContent = 'Validating code...';\n\n\t\t\t\t\t\tconst isValid = await validateSponsor(sponsorCode);\n\n\t\t\t\t\t\tif (isValid === false) {\n\t\t\t\t\t\t\tshowMessage('The influencer code is not valid. Please check and try again.', 'error');\n\t\t\t\t\t\t\tsubmitBtn.disabled = false;\n\t\t\t\t\t\t\tsubmitBtn.textContent = 'Create Account';\n\t\t\t\t\t\t\tsponsorInput.focus();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (isValid === null) {\n\t\t\t\t\t\t\tshowMessage('Could not verify the influencer code. Please try again.', 'error');\n\t\t\t\t\t\t\tsubmitBtn.disabled = false;\n\t\t\t\t\t\t\tsubmitBtn.textContent = 'Create Account';\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t\/\/ Double-check: Block submit if sponsor code is explicitly invalid\n\t\t\t\t\tif (sponsorValidationState.isValid === false) {\n\t\t\t\t\t\tshowMessage('The influencer code is not valid. Please check and try again.', 'error');\n\t\t\t\t\t\tsponsorInput.focus();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsubmitBtn.disabled = true;\n\t\t\t\tsubmitBtn.textContent = 'Creating account...';\n\n\t\t\t\tconst formData = new FormData(form);\n\n\t\t\t\tfetch('https:\/\/feelthevibe.fit\/wp-admin\/admin-ajax.php', {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody: formData\n\t\t\t\t})\n\t\t\t\t.then(r => r.json())\n\t\t\t\t.then(data => {\n\t\t\t\t\tif (data.success) {\n\t\t\t\t\t\tshowMessage(data.data.message, 'success');\n\t\t\t\t\t\tform.reset();\n\t\t\t\t\t\tsetTimeout(() => { window.location.href = data.data.redirect; }, 1500);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tshowMessage(data.data.message || 'Registration failed.', 'error');\n\t\t\t\t\t\tsubmitBtn.disabled = false;\n\t\t\t\t\t\tsubmitBtn.textContent = 'Create Account';\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\tshowMessage('Connection error. Please try again.', 'error');\n\t\t\t\t\tsubmitBtn.disabled = false;\n\t\t\t\t\tsubmitBtn.textContent = 'Create Account';\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tfunction showMessage(msg, type) {\n\t\t\t\tmessages.innerHTML = '<div class=\"ac-reg-notice ac-reg-' + type + '\">' + msg + '<\/div>';\n\t\t\t}\n\t\t})();\n\t\t<\/script>\n\t\t\t\t<\/div>\n\t\t\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":10,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-11818","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/feelthevibe.fit\/es\/wp-json\/wp\/v2\/pages\/11818","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/feelthevibe.fit\/es\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/feelthevibe.fit\/es\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/feelthevibe.fit\/es\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/feelthevibe.fit\/es\/wp-json\/wp\/v2\/comments?post=11818"}],"version-history":[{"count":2,"href":"https:\/\/feelthevibe.fit\/es\/wp-json\/wp\/v2\/pages\/11818\/revisions"}],"predecessor-version":[{"id":11826,"href":"https:\/\/feelthevibe.fit\/es\/wp-json\/wp\/v2\/pages\/11818\/revisions\/11826"}],"wp:attachment":[{"href":"https:\/\/feelthevibe.fit\/es\/wp-json\/wp\/v2\/media?parent=11818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}