Forum Replies Created

Viewing 15 replies - 1 through 15 (of 34 total)
  • Thread Starter spungedave

    (@spungedave)

    Thanks for your reply – this helped me to solve the problem. I had not understood that the form must be rendered on the page it posts to, in order for the submission to be processed. Once you helped me grasp that, the solution was very simple. I have the form return to the same page it is posted on. At the top of the page I search the $_POST variables for the field values and grab them. Before, if I found them, I skipped rendering the form, and moved onto step 2. Now if find them, I render the form in a div with display:none attribute, so that the code executes but the user does not see the form again:

    // This code is to pull the email & name from Constant Contact form Post parameters
    $ctct_submitted = FALSE;
    foreach ($_POST as $k => $v) {
    if ( (substr ($k, 0, 5) == "email" ) ) {
    $user_email = $_POST[$k];
    $ctct_submitted = TRUE;
    }
    if ( (substr ($k, 0, 10) == "first_name" ) ) $firstname = $_POST[$k];
    }

    Then later in the page…

    // Check for CTCT form submission, and if so render form in a display:none div so it can process the submission into CTCT
    if ($ctct_submitted) {
    ?>
    <div style="display:none;">
    <?php echo(do_shortcode('[ctct form="55492" show_title="false"]')); ?>
    </div>
    <?php
    }

    This is working like a champ. Thanks again for helping me resolve this problem!

    Thread Starter spungedave

    (@spungedave)

    That is essentially what I did in my first attempt at using the ctct form. The form originally had the same page (/cigar_recommender) as its re-direct to, and in my code at the top of the page I checked for $_POST variables beginning with “email” and “first”, grabbed their values and copied them into my variables for use in the next step of the process. That code all seemed to work except the contact was not created, and nothing appeared in your debug logs, indicating your code never ran. So taking a shot in the dark I tried creating a different, more or less empty page to re-direct to, but again your code never runs. Only if I turn off the re-direct does your code run, but that does not meet the need.

    Any other suggestions? Any way I can trace what is happening? Any way I can call a CTCT function to force the form processing?

    Any further advice is appreciated…

    Thread Starter spungedave

    (@spungedave)

    Your form is the first step in a five step process the user goes through to get personalized cigar recommendations. I originally wrote my own form for this, then I lost five days trying to use your API’s to submit the contact, before deciding to try doing this with your form instead. Unfortunately that is not working either…

    If I turn off the re-direct by setting the No page refresh on the form settings, then the contact gets created, and I see the trail in your debug logs. If I set the re-direct back to the same page which the form is on (my original approach) or to the page I created just for this purpose (see code above) no contact gets created, and there’s nothing added to your debug logs, indicating your code never executed.

    Can you tell me anything else I need to do on the re-direct page to ensure your code executes? Is there a CTCT function I can call to force it to happen? Any advice is greatly appreciated…

    Thread Starter spungedave

    (@spungedave)

    Actually, that hypothesis is not correct at all. The re-direct is a page within the current website (www.epcarrillo.com/cigar_recommender), and WP is being loaded, as is the WP page header – note these two lines of code:

    if ( !defined('ABSPATH') ) require("wp-load.php");

    get_header();

    Can you suggest anything else I need to do to ensure your form processing code gets executed?

    Thread Starter spungedave

    (@spungedave)

    Thanks for responding to my request – I am utterly baffled by this. I have created a page that does nothing but capture the email and first name field values, then re-directs to the page where I complete the rest of our custom process passing them as query parameters:

    <?php
    /*
    * Template Name: EPC-CTCT-Redirect
    * v1.0
    *
    * All this page does is let the CTCT form submission process, then re-direct back to /cigar_recommender with email and first name added
    *
    */

    if ( !defined('ABSPATH') ) require("wp-load.php");

    get_header();

    // Check for POST parms containing user's email
    // This pulls the email & name from Constant Contact form Post parameters
    foreach ($_POST as $k => $v) {
    if ( (substr ($k, 0, 5) == "email" ) ) $user_email = $_POST[$k];
    if ( (substr ($k, 0, 10) == "first_name" ) ) $firstname = $_POST[$k];
    }

    // Redirect back to the /cigar_recommender page with query params added
    $redirect = "/cigar_recommender/?email=".$user_email."&firstname=".$firstname;
    wp_redirect($redirect);
    exit();
    ?>

    These re-directs are working to the extent that the CTCT form re-directs to this page upon submission, and this page grabs the email and first name and re-directs to to the target correctly. BUT the contact does NOT get created in CTCT.

    BTW, in case this suggests some root cause, I feel the need to re-iterate that I have turned debug on in your plugin, but the logs remain empty after many form submissions, which does not seem right. I also notice that when I change settings for your plugin, it confirms the change was made, but then the settings I selected no longer appear. Here’s an example image, after I set Enable logging for debugging purposes, it confirmed that change, and you can see that the menu option Debug Logs appears, but the checkbox is un-checked:

    Thread Starter spungedave

    (@spungedave)

    FYI, I have turned on the debug logs, but nothing appears in them, after numerous subsequent tests…

    Thread Starter spungedave

    (@spungedave)

    Never mind folks, this was apparently being caused by my early errors persisting due to my caching system. All good now thanks…

    Thread Starter spungedave

    (@spungedave)

    Sorry I neglected some context – this is a lesson in the middle of a course that only registered and enrolled users can see. I needed to change a setting on the course so anyone can see the content for now. Try again and you’ll see the links.

    BTW, I just learned this is evidently a Chrome thing. I tested on Edge just now and both the download link and the button work fine. Very puzzling…

    Thread Starter spungedave

    (@spungedave)

    Thanks James, that appears to have worked! SiteKit is re-installed and working on my production site – we appreciate your help…

    DW

    Thread Starter spungedave

    (@spungedave)

    Hi James,

    I am the one & only administrator – my wife has never done anything with the setup of Google on our site as that’s my job :-/

    I do have two different Google logons, [email protected] and [email protected], and I’ve tried these steps with both Google sign-ons, with identical results. In all cases I am re-directed to my local copy of the website, and unable to get the Site Kit dashboard working on the real website. I have deactivated and deleted SiteKit from my local copy, and I’ve looked for any Google auth files in my local copy without success.

    Any further suggestions are appreciated…

    David Wells

    Thread Starter spungedave

    (@spungedave)

    Hi James,

    I’m still trying to resolve this without any success. I’m unable to follow your instructions above, as I do not have the Settings option under SiteKit (see screenshot here: https://i.imgur.com/0Pd6pmp.png). When I click the button “Sign in with Google”, then sign in, I’m asked to grant access to my Adsense data, and told all other access has already been granted. Here’s the rub – when I click to accept, I am once again re-directed to my LOCALHOST copy of this website.

    Somehow, I’ve gotten Google confused as to what the real website is. How can I disconnect my local copy of the website from Google??

    Thanks for any advice…

    David Wells

    Thread Starter spungedave

    (@spungedave)

    FWIW, we’ve given up on it – the UX for Save & Continue is not quite as fool-proof, but it’s not too bad, so we’ve abandoned the old Data Persistence plugin…

    D

    Thread Starter spungedave

    (@spungedave)

    Oooooohhhh…

    Well here’s an odd twist that suggests perhaps this problem has nothing to do with the SiteKit update but rather stems from work I also did last week to create a local copy of this WP site on my laptop. I clicked the button to “Sign in with Google”, and went through a series of questions to authorize access, then I was re-directed to my local copy of the website, which I happen to have offline right now (screenshot: https://i.imgur.com/4okhow5.png).

    Does this give any clue how I can correct the problem?

    Thanks,

    DW

    Thread Starter spungedave

    (@spungedave)

    Ok, I’ve disconnected, and here’s one oddity – it says: “You revoked access to Site Kit for https://www.cigarsense.com
    Site Kit will no longer have access to your account. If you’d like to reconnect Site Kit, click “Start Setup” below to generate new credentials.”

    Yet there is no “Start Setup” link anywhere on the page – screenshot: https://i.imgur.com/tRkVUsF.png

    So I need to figure out how to re-do the setup…

    Thread Starter spungedave

    (@spungedave)

    Hi James,

    1. Same error as it has been for last week or so, since I did latest updates : “Error: Looks like your site is not allowed access to Google account data and can’t display stats in the dashboard.”

    2. There is one other administrator, my wife Franca, but she definitely is not oding any backend WP Admin activity.

    3. Same, only verified users are myself and my wife

    Any further advice is appreciated…

    DW

Viewing 15 replies - 1 through 15 (of 34 total)