diff --git a/EMAILCASES.md b/EMAILCASES.md index 00e0069..7048f89 100644 --- a/EMAILCASES.md +++ b/EMAILCASES.md @@ -33,7 +33,7 @@ Hello, and thank you for joining the Better Deal for Data community! We're grateful for your endorsement of the BD4D Standard, and excited to welcome you to this movement to unlock the full potential of data to serve society. -This message is to confirm that we have your permission to display your name and affiliation as a BD4D Endorser on our website. We will contact you if we have additional questions regarding your endorsement. +This message is to confirm that we have your permission to display your name (and affiliation if you've provided one) as a BD4D Endorser on our website. We will contact you if we have additional questions regarding your endorsement. If you would like to sign up for our email newsletter in the future, or if you have feedback, questions, or a data story to share, please do send us a message at info@bd4d.org. We'd love to hear from you! @@ -44,6 +44,8 @@ Celine M Celine Takatsuno Better Deal for Data, a Tech Matters initiative. Tech Matters is a nonprofit tech organization. + +Follow us on Bluesky (https://bsky.app/profile/bd4d.bsky.social) and LinkedIn (https://www.linkedin.com/company/better-deal-for-data/) ``` --- @@ -57,10 +59,12 @@ Hello, and thank you for joining the Better Deal for Data community! We're grateful for your endorsement of the BD4D Standard, and excited to welcome you to this movement to unlock the full potential of data to serve society. This message is to confirm: -• We have permission to display your name and affiliation as a BD4D Endorser on our website; and + +• We have permission to display your name (and affiliation if you've provided one) as a BD4D Endorser on our website; and + • You have subscribed to our email updates via our website. If you wish to unsubscribe from our email updates, please reply to this email with the word "Unsubscribe." -We'd love to hear your feedback, questions, or stories about data! You can reach us at info@bd4d.org. +We'd love to hear your feedback, questions, or stories about data! You can reach us at info@bd4d.org, and follow us on Bluesky (https://bsky.app/profile/bd4d.bsky.social) and LinkedIn (https://www.linkedin.com/company/better-deal-for-data/)! All the best, Celine @@ -81,7 +85,7 @@ Hello, and welcome to the Better Deal for Data community–we're excited to supp We'd love to learn more about how you work with data for good, and answer any questions you have about the BD4D Commitments, BD4D Playbook, or implementation. We will contact you personally within the next two business days. -In the meantime, please don't hesitate to contact us at info@bd4d.org to share any feedback or ideas. +In the meantime, please don't hesitate to contact us at info@bd4d.org to share any feedback or ideas, and follow us on Bluesky (https://bsky.app/profile/bd4d.bsky.social) and LinkedIn (https://www.linkedin.com/company/better-deal-for-data/). Many thanks, Celine @@ -94,19 +98,9 @@ Tech Matters is a nonprofit tech organization. --- -## Case E: No checkboxes selected (email provided) +## Case E: No checkboxes selected Newsletter: ✗ | Endorser: ✗ | Adoption: ✗ -``` -Hello, and thank you for joining the Better Deal for Data community! - -We're excited to welcome you to the movement to unlock the full potential of data to serve society. - -All the best, -Celine - -– -M Celine Takatsuno -Better Deal for Data, a Tech Matters initiative. -Tech Matters is a nonprofit tech organization. -``` +**No auto-reply email is sent.** The submission is still recorded in Airtable and the on-page +success message is shown, but a confirmation email is only sent when the user opts into at least one +of newsletter / endorser / adoption (Cases A–D). diff --git a/README.md b/README.md index 58fbac8..a816a7d 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ The plugin writes form submissions to Airtable via the REST API (`https://api.ai | `Adoption?` | Adoption checkbox | Boolean | Always sent | | `CotW-Opted In?` | _Supporter checkbox — removed from form (v1.0.6); field retained for historical opt-ins_ | Boolean | No longer sent | -**Note:** At least one of `Email Address` or `Form Comments` must be provided for submission. +**Note:** First and Last Name are required. Email Address is required only when an opt-in checkbox (newsletter / endorser / adoption) is checked; otherwise it is optional. ### Key Files diff --git a/wp-content/plugins/bd4d/assets/js/main.min.js b/wp-content/plugins/bd4d/assets/js/main.min.js index c7084fc..0897a07 100644 --- a/wp-content/plugins/bd4d/assets/js/main.min.js +++ b/wp-content/plugins/bd4d/assets/js/main.min.js @@ -1 +1 @@ -window.bd4d={getRecaptchaToken:function(){return new Promise(function(e){window.grecaptcha&&localize.sitekey?grecaptcha.ready(function(){grecaptcha.execute(localize.sitekey,{action:"validate_captcha"}).then(e).catch(function(){e("")})}):e("")})},processSubscription:function(a){let i=document.querySelector('input[type="submit"]'),s=i.value,t=(i.value="Sending...",i.classList.add("is-loading"),i.setAttribute("disabled","disabled"),a.preventDefault(),{_ajax_nonce:localize._ajax_nonce,action:"send_message"});var e=a.target.querySelector('input[name="first_name"]').value.trim(),r=a.target.querySelector('input[name="last_name"]').value.trim();let n=a.target.querySelector('input[name="email"]').value.trim();var o=a.target.querySelector('input[name="affiliation"]').value.trim(),d=a.target.querySelector('textarea[name="message"]').value.trim(),l=a.target.querySelector('input[name="newsletter"]'),c=a.target.querySelector('input[name="endorser"]'),u=a.target.querySelector('input[name="adoption"]');n&&(t.email=n),e&&(t.first_name=e),r&&(t.last_name=r),o&&(t.affiliation=o),d&&(t.message=d),l.checked&&(t.newsletter=l.value),c.checked&&(t.endorser=c.value),u.checked&&(t.adoption=u.value),(l.checked||c.checked||u.checked)&&!n?((e=a.target.querySelector('input[name="email"]')).setCustomValidity(localize.error_codes[10]),e.reportValidity(),window.bd4d.resetButton(i,s)):n||d?window.bd4d.getRecaptchaToken().then(e=>{t.token=e,jQuery.ajax({type:"POST",url:localize._ajax_url,data:t,timeout:3e4,success:t=>{if(!0===t.success)a.target.querySelector(".error-message").textContent="",jQuery(a.target.querySelector(".form-fields")).slideUp(),document.querySelectorAll("#joinbd4dnet .et_pb_text_inner,#joinbd4dnet .form-fields").forEach(e=>e.classList.add("hidden")),a.target.querySelector(".message").classList.remove("hidden"),n?a.target.querySelectorAll(".message .yes-email").forEach(e=>e.classList.remove("hidden")):a.target.querySelectorAll(".message .no-email").forEach(e=>e.classList.remove("hidden"));else{let e=localize.error_codes[t?.data?.error_code];4===t?.data?.error_code&&(e+=` (${t?.data?.error_message})`),window.bd4d.showError(i,s,a.target,e)}},error:(e,t)=>{let r=localize.error_codes[3];"timeout"===t?r="The request timed out. Please try again.":403===e?.status&&(r="Your session expired. Please refresh the page and try again."),window.bd4d.showError(i,s,a.target,r)}})}):(a.target.querySelectorAll("#inline-subscribe-email,#inline-subscribe-message").forEach(e=>e.classList.add("has-error")),a.target.querySelector(".error-message").textContent=localize.error_codes[6],window.bd4d.resetButton(i,s))},emailFieldHandler:function(e){e.target.setCustomValidity(""),e.target.classList.remove("has-error")},messageFieldHandler:function(e){e.target.value.trim()&&window.bd4d.messageField.classList.remove("has-error")},resetButton:function(e,t){e.value=t,e.classList.remove("is-loading"),e.removeAttribute("disabled")},showError:function(e,t,r,a){r=r.querySelector(".error-message");e.value="Failed!",e.classList.remove("is-loading"),e.classList.add("is-error"),r.textContent=a,r.classList.add("is-visible"),setTimeout(function(){e.value=t,e.classList.remove("is-error"),e.removeAttribute("disabled")},2e3)},setup:function(){var e=document.getElementById("inline-subscribe");e&&(window.bd4d.emailField=document.getElementById("inline-subscribe-email"),window.bd4d.messageField=document.getElementById("inline-subscribe-message"),window.bd4d.emailField.addEventListener("input",window.bd4d.emailFieldHandler),window.bd4d.messageField.addEventListener("input",window.bd4d.messageFieldHandler),e.addEventListener("submit",window.bd4d.processSubscription))}},document.addEventListener("DOMContentLoaded",window.bd4d.setup); \ No newline at end of file +window.bd4d={getRecaptchaToken:function(){return new Promise(function(e){window.grecaptcha&&localize.sitekey?grecaptcha.ready(function(){grecaptcha.execute(localize.sitekey,{action:"validate_captcha"}).then(e).catch(function(){e("")})}):e("")})},getFreshNonce:function(){return new Promise(function(t){jQuery.ajax({type:"POST",url:localize._ajax_url,data:{action:"bd4d_nonce"},timeout:15e3,success:e=>t(e?.data?.nonce||localize._ajax_nonce),error:()=>t(localize._ajax_nonce)})})},processSubscription:function(r){let i=document.querySelector('input[type="submit"]'),n=i.value,a=(i.value="Sending...",i.classList.add("is-loading"),i.setAttribute("disabled","disabled"),r.preventDefault(),{_ajax_nonce:localize._ajax_nonce,action:"send_message"});var e=r.target.querySelector('input[name="first_name"]').value.trim(),t=r.target.querySelector('input[name="last_name"]').value.trim(),o=r.target.querySelector('input[name="email"]').value.trim(),s=r.target.querySelector('input[name="affiliation"]').value.trim();let d=r.target.querySelector('textarea[name="message"]').value.trim(),l=r.target.querySelector('input[name="newsletter"]'),c=r.target.querySelector('input[name="endorser"]'),u=r.target.querySelector('input[name="adoption"]');o&&(a.email=o),e&&(a.first_name=e),t&&(a.last_name=t),s&&(a.affiliation=s),d&&(a.message=d),l.checked&&(a.newsletter=l.value),c.checked&&(a.endorser=c.value),u.checked&&(a.adoption=u.value),(l.checked||c.checked||u.checked)&&!o?((e=r.target.querySelector('input[name="email"]')).setCustomValidity(localize.error_codes[10]),e.reportValidity(),window.bd4d.resetButton(i,n)):Promise.all([window.bd4d.getFreshNonce(),window.bd4d.getRecaptchaToken()]).then(([e,t])=>{a._ajax_nonce=e,a.token=t,jQuery.ajax({type:"POST",url:localize._ajax_url,data:a,timeout:3e4,success:t=>{if(!0===t.success){r.target.querySelector(".error-message").textContent="",jQuery(r.target.querySelector(".form-fields")).slideUp(),document.querySelectorAll("#joinbd4dnet .et_pb_text_inner,#joinbd4dnet .form-fields").forEach(e=>e.classList.add("hidden")),r.target.querySelector(".message").classList.remove("hidden");let e;e=l.checked||c.checked||u.checked?".msg-optin":d?".msg-comment":".msg-nocomment",r.target.querySelectorAll(".message "+e).forEach(e=>e.classList.remove("hidden"))}else{let e=localize.error_codes[t?.data?.error_code];4===t?.data?.error_code&&(e+=` (${t?.data?.error_message})`),window.bd4d.showError(i,n,r.target,e)}},error:(e,t)=>{let a=localize.error_codes[3];"timeout"===t?a="The request timed out. Please try again.":403===e?.status&&(a="Your session expired. Please refresh the page and try again."),window.bd4d.showError(i,n,r.target,a)}})})},emailFieldHandler:function(e){e.target.setCustomValidity(""),e.target.classList.remove("has-error")},messageFieldHandler:function(e){e.target.value.trim()&&window.bd4d.messageField.classList.remove("has-error")},resetButton:function(e,t){e.value=t,e.classList.remove("is-loading"),e.removeAttribute("disabled")},showError:function(e,t,a,r){a=a.querySelector(".error-message");e.value="Failed!",e.classList.remove("is-loading"),e.classList.add("is-error"),a.textContent=r,a.classList.add("is-visible"),setTimeout(function(){e.value=t,e.classList.remove("is-error"),e.removeAttribute("disabled")},2e3)},setup:function(){var e=document.getElementById("inline-subscribe");e&&(window.bd4d.emailField=document.getElementById("inline-subscribe-email"),window.bd4d.messageField=document.getElementById("inline-subscribe-message"),window.bd4d.emailField.addEventListener("input",window.bd4d.emailFieldHandler),window.bd4d.messageField.addEventListener("input",window.bd4d.messageFieldHandler),e.addEventListener("submit",window.bd4d.processSubscription))}},document.addEventListener("DOMContentLoaded",window.bd4d.setup); \ No newline at end of file diff --git a/wp-content/plugins/bd4d/assets/js/main.src.js b/wp-content/plugins/bd4d/assets/js/main.src.js index 4e0337f..c104fcc 100644 --- a/wp-content/plugins/bd4d/assets/js/main.src.js +++ b/wp-content/plugins/bd4d/assets/js/main.src.js @@ -22,6 +22,24 @@ window.bd4d = { } ); }, + getFreshNonce: function() { + + // The contact form page is cached, so the nonce baked into its HTML can + // be stale or expired by submit time (which fails as a 403). Fetch a + // fresh one from the never-cached admin-ajax endpoint instead, falling + // back to the baked-in nonce if the request fails. + return new Promise( function( resolve ) { + jQuery.ajax( { + type: 'POST', + url: localize._ajax_url, + data: { action: 'bd4d_nonce' }, + timeout: 15000, + success: ( res ) => resolve( res?.data?.nonce || localize._ajax_nonce ), + error: () => resolve( localize._ajax_nonce ) + } ); + } ); + }, + processSubscription: function( event ) { const submitButton = document.querySelector( 'input[type="submit"]' ); const originalButtonText = submitButton.value; @@ -89,19 +107,12 @@ window.bd4d = { return; } - if ( ! emailAddress && ! message ) { - event.target - .querySelectorAll( '#inline-subscribe-email,#inline-subscribe-message' ) - .forEach( ( item ) => item.classList.add( 'has-error' ) ); - event.target.querySelector( '.error-message' ).textContent = localize.error_codes[6]; - window.bd4d.resetButton( submitButton, originalButtonText ); - return; - } - - // Fetch a fresh reCAPTCHA token, then send. Doing this at submit time - // (rather than at page load) avoids expired-token failures for people - // who spend more than ~2 minutes filling out the form. - window.bd4d.getRecaptchaToken().then( ( token ) => { + // Fetch a fresh reCAPTCHA token and a fresh nonce at submit time, then + // send. The reCAPTCHA token expires ~2 min after generation, and the + // nonce baked into the cached page can be stale (causing a 403), so both + // are refreshed here rather than trusting the page-load values. + Promise.all( [ window.bd4d.getFreshNonce(), window.bd4d.getRecaptchaToken() ] ).then( ( [ nonce, token ] ) => { + data._ajax_nonce = nonce; data.token = token; jQuery.ajax( { @@ -118,15 +129,20 @@ window.bd4d = { .querySelectorAll( '#joinbd4dnet .et_pb_text_inner,#joinbd4dnet .form-fields' ) .forEach( ( item ) => item.classList.add( 'hidden' ) ); event.target.querySelector( '.message' ).classList.remove( 'hidden' ); - if ( emailAddress ) { - event.target - .querySelectorAll( '.message .yes-email' ) - .forEach( ( item ) => item.classList.remove( 'hidden' ) ); + + // Pick the success message: any opt-in checked -> "watch your + // inbox"; otherwise it depends on whether a comment was given. + let messageVariant; + if ( newsletter.checked || endorser.checked || adoption.checked ) { + messageVariant = '.msg-optin'; + } else if ( message ) { + messageVariant = '.msg-comment'; } else { - event.target - .querySelectorAll( '.message .no-email' ) - .forEach( ( item ) => item.classList.remove( 'hidden' ) ); + messageVariant = '.msg-nocomment'; } + event.target + .querySelectorAll( '.message ' + messageVariant ) + .forEach( ( item ) => item.classList.remove( 'hidden' ) ); } else { let errorMessage = localize.error_codes[res?.data?.error_code]; if ( 4 === res?.data?.error_code ) { diff --git a/wp-content/plugins/bd4d/assets/js/main.src.js.map b/wp-content/plugins/bd4d/assets/js/main.src.js.map index 187afe2..d659c8e 100644 --- a/wp-content/plugins/bd4d/assets/js/main.src.js.map +++ b/wp-content/plugins/bd4d/assets/js/main.src.js.map @@ -1 +1 @@ -{"version":3,"sources":["src/main.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACf,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAChC;AACA,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;AAC1E,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,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AC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE;AACzF;AACA,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE;AAC/E,EAAE,CAAC;AACH,CAAC,CAAC;AACF,EAAE;AACF;AACA,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE","file":"main.src.js","sourcesContent":["window.bd4d = {\n\tgetRecaptchaToken: function() {\n\n\t\t// reCAPTCHA v3 tokens expire ~2 minutes after they are generated, so we\n\t\t// must mint a fresh one at submit time rather than once at page load.\n\t\t// Resolves to an empty string if reCAPTCHA is unavailable (adblock,\n\t\t// script load failure) so the request still goes through and the server\n\t\t// decides how to handle a missing token.\n\t\treturn new Promise( function( resolve ) {\n\t\t\tif ( ! window.grecaptcha || ! localize.sitekey ) {\n\t\t\t\tresolve( '' );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tgrecaptcha.ready( function() {\n\t\t\t\tgrecaptcha\n\t\t\t\t\t.execute( localize.sitekey, { action: 'validate_captcha' } )\n\t\t\t\t\t.then( resolve )\n\t\t\t\t\t.catch( function() {\n\t\t\t\t\t\tresolve( '' );\n\t\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t},\n\n\tprocessSubscription: function( event ) {\n\t\tconst submitButton = document.querySelector( 'input[type=\"submit\"]' );\n\t\tconst originalButtonText = submitButton.value;\n\t\tsubmitButton.value = 'Sending...';\n\t\tsubmitButton.classList.add( 'is-loading' );\n\t\tsubmitButton.setAttribute( 'disabled', 'disabled' );\n\n\t\tevent.preventDefault();\n\n\t\tlet data = {\n\t\t\t_ajax_nonce: localize._ajax_nonce,\n\t\t\taction: 'send_message'\n\t\t};\n\n\t\tconst firstName = event.target.querySelector( 'input[name=\"first_name\"]' ).value.trim();\n\t\tconst lastName = event.target.querySelector( 'input[name=\"last_name\"]' ).value.trim();\n\t\tconst emailAddress = event.target.querySelector( 'input[name=\"email\"]' ).value.trim();\n\t\tconst affiliation = event.target.querySelector( 'input[name=\"affiliation\"]' ).value.trim();\n\t\tconst message = event.target.querySelector( 'textarea[name=\"message\"]' ).value.trim();\n\t\tconst newsletter = event.target.querySelector( 'input[name=\"newsletter\"]' );\n\t\tconst endorser = event.target.querySelector( 'input[name=\"endorser\"]' );\n\t\tconst adoption = event.target.querySelector( 'input[name=\"adoption\"]' );\n\n\t\tif ( emailAddress ) {\n\t\t\tdata.email = emailAddress;\n\t\t}\n\n\t\tif ( firstName ) {\n\t\t\tdata.first_name = firstName;\n\t\t}\n\n\t\tif ( lastName ) {\n\t\t\tdata.last_name = lastName;\n\t\t}\n\n\t\tif ( affiliation ) {\n\t\t\tdata.affiliation = affiliation;\n\t\t}\n\n\t\tif ( message ) {\n\t\t\tdata.message = message;\n\t\t}\n\n\t\tif ( newsletter.checked ) {\n\t\t\tdata.newsletter = newsletter.value;\n\t\t}\n\n\t\tif ( endorser.checked ) {\n\t\t\tdata.endorser = endorser.value;\n\t\t}\n\n\t\tif ( adoption.checked ) {\n\t\t\tdata.adoption = adoption.value;\n\t\t}\n\n\t\tif ( ( newsletter.checked || endorser.checked || adoption.checked ) && ! emailAddress ) {\n\n\t\t\t// An opt-in checkbox requires an email. Surface it via the browser's\n\t\t\t// native validation popup on the email field — the same UX as the\n\t\t\t// required first/last name fields — rather than the message below.\n\t\t\tconst emailInput = event.target.querySelector( 'input[name=\"email\"]' );\n\t\t\temailInput.setCustomValidity( localize.error_codes[10] );\n\t\t\temailInput.reportValidity();\n\t\t\twindow.bd4d.resetButton( submitButton, originalButtonText );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! emailAddress && ! message ) {\n\t\t\tevent.target\n\t\t\t\t.querySelectorAll( '#inline-subscribe-email,#inline-subscribe-message' )\n\t\t\t\t.forEach( ( item ) => item.classList.add( 'has-error' ) );\n\t\t\tevent.target.querySelector( '.error-message' ).textContent = localize.error_codes[6];\n\t\t\twindow.bd4d.resetButton( submitButton, originalButtonText );\n\t\t\treturn;\n\t\t}\n\n\t\t// Fetch a fresh reCAPTCHA token, then send. Doing this at submit time\n\t\t// (rather than at page load) avoids expired-token failures for people\n\t\t// who spend more than ~2 minutes filling out the form.\n\t\twindow.bd4d.getRecaptchaToken().then( ( token ) => {\n\t\t\tdata.token = token;\n\n\t\t\tjQuery.ajax( {\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: localize._ajax_url,\n\t\t\t\tdata: data,\n\t\t\t\ttimeout: 30000,\n\t\t\t\tsuccess: ( res ) => {\n\t\t\t\t\tif ( true === res.success ) {\n\t\t\t\t\t\tevent.target.querySelector( '.error-message' ).textContent = '';\n\n\t\t\t\t\t\tjQuery( event.target.querySelector( '.form-fields' ) ).slideUp();\n\t\t\t\t\t\tdocument\n\t\t\t\t\t\t\t.querySelectorAll( '#joinbd4dnet .et_pb_text_inner,#joinbd4dnet .form-fields' )\n\t\t\t\t\t\t\t.forEach( ( item ) => item.classList.add( 'hidden' ) );\n\t\t\t\t\t\tevent.target.querySelector( '.message' ).classList.remove( 'hidden' );\n\t\t\t\t\t\tif ( emailAddress ) {\n\t\t\t\t\t\t\tevent.target\n\t\t\t\t\t\t\t\t.querySelectorAll( '.message .yes-email' )\n\t\t\t\t\t\t\t\t.forEach( ( item ) => item.classList.remove( 'hidden' ) );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tevent.target\n\t\t\t\t\t\t\t\t.querySelectorAll( '.message .no-email' )\n\t\t\t\t\t\t\t\t.forEach( ( item ) => item.classList.remove( 'hidden' ) );\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet errorMessage = localize.error_codes[res?.data?.error_code];\n\t\t\t\t\t\tif ( 4 === res?.data?.error_code ) {\n\n\t\t\t\t\t\t\t// 4 is a JSON parsing error.\n\t\t\t\t\t\t\terrorMessage += ` (${res?.data?.error_message})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twindow.bd4d.showError( submitButton, originalButtonText, event.target, errorMessage );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: ( jqXHR, textStatus ) => {\n\n\t\t\t\t\t// Any transport-level failure (HTTP 4xx/5xx, timeout, network drop)\n\t\t\t\t\t// lands here. Without this handler the button hangs on \"Sending...\".\n\t\t\t\t\tlet errorMessage = localize.error_codes[3]; // SEND_ERROR: 'Unable to send message'.\n\t\t\t\t\tif ( 'timeout' === textStatus ) {\n\t\t\t\t\t\terrorMessage = 'The request timed out. Please try again.';\n\t\t\t\t\t} else if ( 403 === jqXHR?.status ) {\n\n\t\t\t\t\t\t// Usually a stale/expired security token — a fresh page load fixes it.\n\t\t\t\t\t\terrorMessage = 'Your session expired. Please refresh the page and try again.';\n\t\t\t\t\t}\n\t\t\t\t\twindow.bd4d.showError( submitButton, originalButtonText, event.target, errorMessage );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t},\n\n\temailFieldHandler: function( event ) {\n\n\t\t// Clear the email field's validation state as the user types, so a prior\n\t\t// \"email required\" popup or error styling doesn't persist.\n\t\tevent.target.setCustomValidity( '' );\n\t\tevent.target.classList.remove( 'has-error' );\n\t},\n\n\tmessageFieldHandler: function( event ) {\n\t\tif ( event.target.value.trim() ) {\n\t\t\twindow.bd4d.messageField.classList.remove( 'has-error' );\n\t\t}\n\t},\n\n\tresetButton: function( button, originalText ) {\n\t\tbutton.value = originalText;\n\t\tbutton.classList.remove( 'is-loading' );\n\t\tbutton.removeAttribute( 'disabled' );\n\t},\n\n\tshowError: function( button, originalText, form, errorMessage ) {\n\t\tconst errorDiv = form.querySelector( '.error-message' );\n\n\t\t// Show \"Failed!\" on button briefly.\n\t\tbutton.value = 'Failed!';\n\t\tbutton.classList.remove( 'is-loading' );\n\t\tbutton.classList.add( 'is-error' );\n\n\t\t// Show and highlight error message.\n\t\terrorDiv.textContent = errorMessage;\n\t\terrorDiv.classList.add( 'is-visible' );\n\n\t\t// After 2 seconds, restore button to normal state.\n\t\tsetTimeout( function() {\n\t\t\tbutton.value = originalText;\n\t\t\tbutton.classList.remove( 'is-error' );\n\t\t\tbutton.removeAttribute( 'disabled' );\n\t\t}, 2000 );\n\t},\n\n\tsetup: function() {\n\t\tconst subscribeForm = document.getElementById( 'inline-subscribe' );\n\n\t\tif ( subscribeForm ) {\n\t\t\twindow.bd4d.emailField = document.getElementById( 'inline-subscribe-email' );\n\t\t\twindow.bd4d.messageField = document.getElementById( 'inline-subscribe-message' );\n\t\t\twindow.bd4d.emailField.addEventListener( 'input', window.bd4d.emailFieldHandler );\n\t\t\twindow.bd4d.messageField.addEventListener( 'input', window.bd4d.messageFieldHandler );\n\n\t\t\tsubscribeForm.addEventListener( 'submit', window.bd4d.processSubscription );\n\t\t}\n\t}\n};\n\ndocument.addEventListener( 'DOMContentLoaded', window.bd4d.setup );\n"]} \ No newline at end of file +{"version":3,"sources":["src/main.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACf,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAChC;AACA,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;AAC1E,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;AACxE,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE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AAE;AACpF,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE;AACrF,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE;AACzF;AACA,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE;AAC/E,EAAE,CAAC;AACH,CAAC,CAAC;AACF,EAAE;AACF;AACA,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE","file":"main.src.js","sourcesContent":["window.bd4d = {\n\tgetRecaptchaToken: function() {\n\n\t\t// reCAPTCHA v3 tokens expire ~2 minutes after they are generated, so we\n\t\t// must mint a fresh one at submit time rather than once at page load.\n\t\t// Resolves to an empty string if reCAPTCHA is unavailable (adblock,\n\t\t// script load failure) so the request still goes through and the server\n\t\t// decides how to handle a missing token.\n\t\treturn new Promise( function( resolve ) {\n\t\t\tif ( ! window.grecaptcha || ! localize.sitekey ) {\n\t\t\t\tresolve( '' );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tgrecaptcha.ready( function() {\n\t\t\t\tgrecaptcha\n\t\t\t\t\t.execute( localize.sitekey, { action: 'validate_captcha' } )\n\t\t\t\t\t.then( resolve )\n\t\t\t\t\t.catch( function() {\n\t\t\t\t\t\tresolve( '' );\n\t\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t},\n\n\tgetFreshNonce: function() {\n\n\t\t// The contact form page is cached, so the nonce baked into its HTML can\n\t\t// be stale or expired by submit time (which fails as a 403). Fetch a\n\t\t// fresh one from the never-cached admin-ajax endpoint instead, falling\n\t\t// back to the baked-in nonce if the request fails.\n\t\treturn new Promise( function( resolve ) {\n\t\t\tjQuery.ajax( {\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: localize._ajax_url,\n\t\t\t\tdata: { action: 'bd4d_nonce' },\n\t\t\t\ttimeout: 15000,\n\t\t\t\tsuccess: ( res ) => resolve( res?.data?.nonce || localize._ajax_nonce ),\n\t\t\t\terror: () => resolve( localize._ajax_nonce )\n\t\t\t} );\n\t\t} );\n\t},\n\n\tprocessSubscription: function( event ) {\n\t\tconst submitButton = document.querySelector( 'input[type=\"submit\"]' );\n\t\tconst originalButtonText = submitButton.value;\n\t\tsubmitButton.value = 'Sending...';\n\t\tsubmitButton.classList.add( 'is-loading' );\n\t\tsubmitButton.setAttribute( 'disabled', 'disabled' );\n\n\t\tevent.preventDefault();\n\n\t\tlet data = {\n\t\t\t_ajax_nonce: localize._ajax_nonce,\n\t\t\taction: 'send_message'\n\t\t};\n\n\t\tconst firstName = event.target.querySelector( 'input[name=\"first_name\"]' ).value.trim();\n\t\tconst lastName = event.target.querySelector( 'input[name=\"last_name\"]' ).value.trim();\n\t\tconst emailAddress = event.target.querySelector( 'input[name=\"email\"]' ).value.trim();\n\t\tconst affiliation = event.target.querySelector( 'input[name=\"affiliation\"]' ).value.trim();\n\t\tconst message = event.target.querySelector( 'textarea[name=\"message\"]' ).value.trim();\n\t\tconst newsletter = event.target.querySelector( 'input[name=\"newsletter\"]' );\n\t\tconst endorser = event.target.querySelector( 'input[name=\"endorser\"]' );\n\t\tconst adoption = event.target.querySelector( 'input[name=\"adoption\"]' );\n\n\t\tif ( emailAddress ) {\n\t\t\tdata.email = emailAddress;\n\t\t}\n\n\t\tif ( firstName ) {\n\t\t\tdata.first_name = firstName;\n\t\t}\n\n\t\tif ( lastName ) {\n\t\t\tdata.last_name = lastName;\n\t\t}\n\n\t\tif ( affiliation ) {\n\t\t\tdata.affiliation = affiliation;\n\t\t}\n\n\t\tif ( message ) {\n\t\t\tdata.message = message;\n\t\t}\n\n\t\tif ( newsletter.checked ) {\n\t\t\tdata.newsletter = newsletter.value;\n\t\t}\n\n\t\tif ( endorser.checked ) {\n\t\t\tdata.endorser = endorser.value;\n\t\t}\n\n\t\tif ( adoption.checked ) {\n\t\t\tdata.adoption = adoption.value;\n\t\t}\n\n\t\tif ( ( newsletter.checked || endorser.checked || adoption.checked ) && ! emailAddress ) {\n\n\t\t\t// An opt-in checkbox requires an email. Surface it via the browser's\n\t\t\t// native validation popup on the email field — the same UX as the\n\t\t\t// required first/last name fields — rather than the message below.\n\t\t\tconst emailInput = event.target.querySelector( 'input[name=\"email\"]' );\n\t\t\temailInput.setCustomValidity( localize.error_codes[10] );\n\t\t\temailInput.reportValidity();\n\t\t\twindow.bd4d.resetButton( submitButton, originalButtonText );\n\t\t\treturn;\n\t\t}\n\n\t\t// Fetch a fresh reCAPTCHA token and a fresh nonce at submit time, then\n\t\t// send. The reCAPTCHA token expires ~2 min after generation, and the\n\t\t// nonce baked into the cached page can be stale (causing a 403), so both\n\t\t// are refreshed here rather than trusting the page-load values.\n\t\tPromise.all( [ window.bd4d.getFreshNonce(), window.bd4d.getRecaptchaToken() ] ).then( ( [ nonce, token ] ) => {\n\t\t\tdata._ajax_nonce = nonce;\n\t\t\tdata.token = token;\n\n\t\t\tjQuery.ajax( {\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: localize._ajax_url,\n\t\t\t\tdata: data,\n\t\t\t\ttimeout: 30000,\n\t\t\t\tsuccess: ( res ) => {\n\t\t\t\t\tif ( true === res.success ) {\n\t\t\t\t\t\tevent.target.querySelector( '.error-message' ).textContent = '';\n\n\t\t\t\t\t\tjQuery( event.target.querySelector( '.form-fields' ) ).slideUp();\n\t\t\t\t\t\tdocument\n\t\t\t\t\t\t\t.querySelectorAll( '#joinbd4dnet .et_pb_text_inner,#joinbd4dnet .form-fields' )\n\t\t\t\t\t\t\t.forEach( ( item ) => item.classList.add( 'hidden' ) );\n\t\t\t\t\t\tevent.target.querySelector( '.message' ).classList.remove( 'hidden' );\n\n\t\t\t\t\t\t// Pick the success message: any opt-in checked -> \"watch your\n\t\t\t\t\t\t// inbox\"; otherwise it depends on whether a comment was given.\n\t\t\t\t\t\tlet messageVariant;\n\t\t\t\t\t\tif ( newsletter.checked || endorser.checked || adoption.checked ) {\n\t\t\t\t\t\t\tmessageVariant = '.msg-optin';\n\t\t\t\t\t\t} else if ( message ) {\n\t\t\t\t\t\t\tmessageVariant = '.msg-comment';\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmessageVariant = '.msg-nocomment';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tevent.target\n\t\t\t\t\t\t\t.querySelectorAll( '.message ' + messageVariant )\n\t\t\t\t\t\t\t.forEach( ( item ) => item.classList.remove( 'hidden' ) );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet errorMessage = localize.error_codes[res?.data?.error_code];\n\t\t\t\t\t\tif ( 4 === res?.data?.error_code ) {\n\n\t\t\t\t\t\t\t// 4 is a JSON parsing error.\n\t\t\t\t\t\t\terrorMessage += ` (${res?.data?.error_message})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twindow.bd4d.showError( submitButton, originalButtonText, event.target, errorMessage );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: ( jqXHR, textStatus ) => {\n\n\t\t\t\t\t// Any transport-level failure (HTTP 4xx/5xx, timeout, network drop)\n\t\t\t\t\t// lands here. Without this handler the button hangs on \"Sending...\".\n\t\t\t\t\tlet errorMessage = localize.error_codes[3]; // SEND_ERROR: 'Unable to send message'.\n\t\t\t\t\tif ( 'timeout' === textStatus ) {\n\t\t\t\t\t\terrorMessage = 'The request timed out. Please try again.';\n\t\t\t\t\t} else if ( 403 === jqXHR?.status ) {\n\n\t\t\t\t\t\t// Usually a stale/expired security token — a fresh page load fixes it.\n\t\t\t\t\t\terrorMessage = 'Your session expired. Please refresh the page and try again.';\n\t\t\t\t\t}\n\t\t\t\t\twindow.bd4d.showError( submitButton, originalButtonText, event.target, errorMessage );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t},\n\n\temailFieldHandler: function( event ) {\n\n\t\t// Clear the email field's validation state as the user types, so a prior\n\t\t// \"email required\" popup or error styling doesn't persist.\n\t\tevent.target.setCustomValidity( '' );\n\t\tevent.target.classList.remove( 'has-error' );\n\t},\n\n\tmessageFieldHandler: function( event ) {\n\t\tif ( event.target.value.trim() ) {\n\t\t\twindow.bd4d.messageField.classList.remove( 'has-error' );\n\t\t}\n\t},\n\n\tresetButton: function( button, originalText ) {\n\t\tbutton.value = originalText;\n\t\tbutton.classList.remove( 'is-loading' );\n\t\tbutton.removeAttribute( 'disabled' );\n\t},\n\n\tshowError: function( button, originalText, form, errorMessage ) {\n\t\tconst errorDiv = form.querySelector( '.error-message' );\n\n\t\t// Show \"Failed!\" on button briefly.\n\t\tbutton.value = 'Failed!';\n\t\tbutton.classList.remove( 'is-loading' );\n\t\tbutton.classList.add( 'is-error' );\n\n\t\t// Show and highlight error message.\n\t\terrorDiv.textContent = errorMessage;\n\t\terrorDiv.classList.add( 'is-visible' );\n\n\t\t// After 2 seconds, restore button to normal state.\n\t\tsetTimeout( function() {\n\t\t\tbutton.value = originalText;\n\t\t\tbutton.classList.remove( 'is-error' );\n\t\t\tbutton.removeAttribute( 'disabled' );\n\t\t}, 2000 );\n\t},\n\n\tsetup: function() {\n\t\tconst subscribeForm = document.getElementById( 'inline-subscribe' );\n\n\t\tif ( subscribeForm ) {\n\t\t\twindow.bd4d.emailField = document.getElementById( 'inline-subscribe-email' );\n\t\t\twindow.bd4d.messageField = document.getElementById( 'inline-subscribe-message' );\n\t\t\twindow.bd4d.emailField.addEventListener( 'input', window.bd4d.emailFieldHandler );\n\t\t\twindow.bd4d.messageField.addEventListener( 'input', window.bd4d.messageFieldHandler );\n\n\t\t\tsubscribeForm.addEventListener( 'submit', window.bd4d.processSubscription );\n\t\t}\n\t}\n};\n\ndocument.addEventListener( 'DOMContentLoaded', window.bd4d.setup );\n"]} \ No newline at end of file diff --git a/wp-content/plugins/bd4d/assets/js/src/main.js b/wp-content/plugins/bd4d/assets/js/src/main.js index aa63f58..4d7690f 100644 --- a/wp-content/plugins/bd4d/assets/js/src/main.js +++ b/wp-content/plugins/bd4d/assets/js/src/main.js @@ -22,6 +22,24 @@ window.bd4d = { } ); }, + getFreshNonce: function() { + + // The contact form page is cached, so the nonce baked into its HTML can + // be stale or expired by submit time (which fails as a 403). Fetch a + // fresh one from the never-cached admin-ajax endpoint instead, falling + // back to the baked-in nonce if the request fails. + return new Promise( function( resolve ) { + jQuery.ajax( { + type: 'POST', + url: localize._ajax_url, + data: { action: 'bd4d_nonce' }, + timeout: 15000, + success: ( res ) => resolve( res?.data?.nonce || localize._ajax_nonce ), + error: () => resolve( localize._ajax_nonce ) + } ); + } ); + }, + processSubscription: function( event ) { const submitButton = document.querySelector( 'input[type="submit"]' ); const originalButtonText = submitButton.value; @@ -89,19 +107,12 @@ window.bd4d = { return; } - if ( ! emailAddress && ! message ) { - event.target - .querySelectorAll( '#inline-subscribe-email,#inline-subscribe-message' ) - .forEach( ( item ) => item.classList.add( 'has-error' ) ); - event.target.querySelector( '.error-message' ).textContent = localize.error_codes[6]; - window.bd4d.resetButton( submitButton, originalButtonText ); - return; - } - - // Fetch a fresh reCAPTCHA token, then send. Doing this at submit time - // (rather than at page load) avoids expired-token failures for people - // who spend more than ~2 minutes filling out the form. - window.bd4d.getRecaptchaToken().then( ( token ) => { + // Fetch a fresh reCAPTCHA token and a fresh nonce at submit time, then + // send. The reCAPTCHA token expires ~2 min after generation, and the + // nonce baked into the cached page can be stale (causing a 403), so both + // are refreshed here rather than trusting the page-load values. + Promise.all( [ window.bd4d.getFreshNonce(), window.bd4d.getRecaptchaToken() ] ).then( ( [ nonce, token ] ) => { + data._ajax_nonce = nonce; data.token = token; jQuery.ajax( { @@ -118,15 +129,20 @@ window.bd4d = { .querySelectorAll( '#joinbd4dnet .et_pb_text_inner,#joinbd4dnet .form-fields' ) .forEach( ( item ) => item.classList.add( 'hidden' ) ); event.target.querySelector( '.message' ).classList.remove( 'hidden' ); - if ( emailAddress ) { - event.target - .querySelectorAll( '.message .yes-email' ) - .forEach( ( item ) => item.classList.remove( 'hidden' ) ); + + // Pick the success message: any opt-in checked -> "watch your + // inbox"; otherwise it depends on whether a comment was given. + let messageVariant; + if ( newsletter.checked || endorser.checked || adoption.checked ) { + messageVariant = '.msg-optin'; + } else if ( message ) { + messageVariant = '.msg-comment'; } else { - event.target - .querySelectorAll( '.message .no-email' ) - .forEach( ( item ) => item.classList.remove( 'hidden' ) ); + messageVariant = '.msg-nocomment'; } + event.target + .querySelectorAll( '.message ' + messageVariant ) + .forEach( ( item ) => item.classList.remove( 'hidden' ) ); } else { let errorMessage = localize.error_codes[res?.data?.error_code]; if ( 4 === res?.data?.error_code ) { diff --git a/wp-content/plugins/bd4d/bd4d.php b/wp-content/plugins/bd4d/bd4d.php index 0868d0c..d930c4e 100644 --- a/wp-content/plugins/bd4d/bd4d.php +++ b/wp-content/plugins/bd4d/bd4d.php @@ -12,14 +12,14 @@ * Author: Tech Matters * Text Domain: bd4d * Domain Path: /languages - * Version: 1.0.6 + * Version: 1.0.8 * Requires at least: 6.2 * * @package BD4D */ defined( 'ABSPATH' ) || exit; -define( 'BD4D_VERSION', '1.0.6' ); +define( 'BD4D_VERSION', '1.0.8' ); require_once __DIR__ . '/includes/class-bd4d.php'; require_once __DIR__ . '/includes/settings/class-settings.php'; diff --git a/wp-content/plugins/bd4d/includes/class-bd4d.php b/wp-content/plugins/bd4d/includes/class-bd4d.php index b307512..0feae59 100644 --- a/wp-content/plugins/bd4d/includes/class-bd4d.php +++ b/wp-content/plugins/bd4d/includes/class-bd4d.php @@ -35,6 +35,8 @@ public static function hooks() { add_shortcode( 'bd4d-contact-form', [ __CLASS__, 'render_email_form' ] ); add_action( 'wp_ajax_nopriv_send_message', [ __CLASS__, 'send_message' ] ); add_action( 'wp_ajax_send_message', [ __CLASS__, 'send_message' ] ); + add_action( 'wp_ajax_nopriv_bd4d_nonce', [ __CLASS__, 'get_nonce' ] ); + add_action( 'wp_ajax_bd4d_nonce', [ __CLASS__, 'get_nonce' ] ); add_action( 'wp_enqueue_scripts', [ __CLASS__, 'enqueue_scripts' ] ); } @@ -216,6 +218,19 @@ public static function add( $email, $first_name = false, $last_name = false, $af return self::SEND_ERROR; } + /** + * AJAX handler that returns a fresh nonce. + * + * The contact form page is edge-cached, so the nonce embedded in its HTML + * can be stale or expired by the time a visitor submits, causing the submit + * request to fail check_ajax_referer() with a 403. The frontend fetches a + * fresh nonce from this (never-cached) admin-ajax endpoint at submit time + * instead of trusting the cached one. + */ + public static function get_nonce() { + wp_send_json_success( [ 'nonce' => wp_create_nonce( self::FIELD_NAME ) ] ); + } + /** * AJAX action handler for newsletter subscription action. */ @@ -249,22 +264,27 @@ public static function send_message() { $subject = 'Welcome to a Better Deal for Data'; - $result = self::add( $email, $first_name, $last_name, $affiliation, $message, $newsletter, $endorser, $adoption ); - if ( $email ) { - $body = self::message_body( $message, $newsletter, $endorser, $adoption ); - if ( self::SEND_SUCCESS === $result ) { + $result = self::add( $email, $first_name, $last_name, $affiliation, $message, $newsletter, $endorser, $adoption ); + $any_optin = $newsletter || $endorser || $adoption; + + if ( self::SEND_SUCCESS === $result ) { + // Send the confirmation email only when the user provided an email AND + // opted into at least one option. With an email but no opt-in (Case E), + // the submission is still recorded in Airtable but no email is sent. + if ( $email && $any_optin ) { + $body = self::message_body( $message, $newsletter, $endorser, $adoption ); $email_sent = self::send_confirmation_message( $email, $subject, $body ); if ( ! $email_sent ) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- Intentional logging of email errors for debugging. error_log( 'BD4D contact form email send failed for: ' . $email ); $result = self::SEND_ERROR; - } else { - wp_send_json_success(); } } - } elseif ( self::SEND_SUCCESS === $result ) { + + if ( self::SEND_SUCCESS === $result ) { wp_send_json_success(); return; + } } $data = [ 'error_code' => $result ]; diff --git a/wp-content/plugins/bd4d/template-parts/auto-reply.php b/wp-content/plugins/bd4d/template-parts/auto-reply.php index 1d3c8e1..6da1840 100644 --- a/wp-content/plugins/bd4d/template-parts/auto-reply.php +++ b/wp-content/plugins/bd4d/template-parts/auto-reply.php @@ -12,7 +12,7 @@ We'd love to learn more about how you work with data for good, and answer any questions you have about the BD4D Commitments, BD4D Playbook, or implementation. We will contact you personally within the next two business days. -In the meantime, please don't hesitate to contact us at info@bd4d.org to share any feedback or ideas. +In the meantime, please don't hesitate to contact us at info@bd4d.org to share any feedback or ideas, and follow us on Bluesky (https://bsky.app/profile/bd4d.bsky.social) and LinkedIn (https://www.linkedin.com/company/better-deal-for-data/). Many thanks, @@ -29,15 +29,17 @@ We'd love to hear your feedback, questions, or stories about data! You can reach us at info@bd4d.org. -This message is to confirm that we have your permission to display your name and affiliation as a BD4D Endorser on our website. We will contact you if we have additional questions regarding your endorsement. +This message is to confirm that we have your permission to display your name (and affiliation if you've provided one) as a BD4D Endorser on our website. We will contact you if we have additional questions regarding your endorsement. If you would like to sign up for our email newsletter in the future, or if you have feedback, questions, or a data story to share, please do send us a message at info@bd4d.org. We'd love to hear from you! This message is to confirm: -• We have permission to display your name and affiliation as a BD4D Endorser on our website; and + +• We have permission to display your name (and affiliation if you've provided one) as a BD4D Endorser on our website; and + • You have subscribed to our email updates via our website. If you wish to unsubscribe from our email updates, please reply to this email with the word "Unsubscribe." -We'd love to hear your feedback, questions, or stories about data! You can reach us at info@bd4d.org. +We'd love to hear your feedback, questions, or stories about data! You can reach us at info@bd4d.org, and follow us on Bluesky (https://bsky.app/profile/bd4d.bsky.social) and LinkedIn (https://www.linkedin.com/company/better-deal-for-data/)! All the best, @@ -48,3 +50,7 @@ M Celine Takatsuno Better Deal for Data, a Tech Matters initiative. Tech Matters is a nonprofit tech organization. + + +Follow us on Bluesky (https://bsky.app/profile/bd4d.bsky.social) and LinkedIn (https://www.linkedin.com/company/better-deal-for-data/) + diff --git a/wp-content/plugins/bd4d/template-parts/form-email.php b/wp-content/plugins/bd4d/template-parts/form-email.php index 6aa4b14..a5972a2 100644 --- a/wp-content/plugins/bd4d/template-parts/form-email.php +++ b/wp-content/plugins/bd4d/template-parts/form-email.php @@ -56,11 +56,13 @@

We’re excited for your interest in the BD4D Standard, and the movement to unlock the full potential of data to serve society!

- + - + - + + +