WordPress.org

Ready to get started?Download WordPress

Forums

Aweber personalization for Confirm/Success/Already Subscribed pages? (13 posts)

  1. mitchpowell
    Member
    Posted 4 years ago #

    I've been unable to get an acceptable answer from Aweber on this issue, and it seems to me it would be a common question. I get 404 errors when I attempt to pass variables from an Aweber opt-in form to my success pages.

    The desired result is personalized "Confirm," "Success," and "Already Subscribed" pages on my WordPress blog. Using the latest version 2.9.2, and even trying it with two or three earlier versions as well, and with different themes and with barebones installations with no other plugins activated.

    I copied the script that Aweber provides for passing variables from a submitted opt-in form to the custom pages I listed when configuring said form; I copied this script to my header.php file, and I created the pages with my permalinks set so that they read just as I entered them in the Aweber form generator interface... well here, forget trying to describe everything so technically. Watch this video instead. It shows it a lot better than I can describe it:

    http://www.screencast.com/t/ZjU4YTM4

    I hope someone can enlighten me on how to do this. I would think many people have wanted to do this very thing, yet I'm not finding answers anywhere.

    Thank you,
    Mitch

  2. kristarella
    Member
    Posted 3 years ago #

    Geez,

    I've seen threads about this up to 2 years old, and this one is 8 months old and I'm having the same problem.

    The problem is that the Aweber form uses a field with the ID and name of "name", which is a reserved term in WordPress: http://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms

    When you use the option to pass the form values to the confirmation page URL the presence of the "name" parameter in the URL causes a 404.

    So far I can find no way to fix this. It seems ridiculous to me that Aweber would use such a generic term in this context.

  3. jiggymhann
    Member
    Posted 3 years ago #

    do you already have the solution on this problem..?

  4. kristarella
    Member
    Posted 3 years ago #

    I had to write an htaccess rule to change "name" in the URL query to "fullname":

    RewriteCond %{QUERY_STRING} (.+?)&name=(.+)
    RewriteRule ^page-name/ /page-name/?%1&fullname=%2 [R,NC,L]
  5. ianm7323
    Member
    Posted 3 years ago #

    Hi Kristarella. I'm happy to read that someone has found a solution to this problem as I too am struggling to get this to work. Could you please elaborate more on your htaccess fix as I have implemented your code but this did not work for me. Nothing changed. After more research I found a fix that involed using the below line in my htaccess file.

    RewriteCond %{REQUEST_URI} !^/(pagename) [NC]

    http://www.ideashower.com/learned/override-wordpress-htaccess-with-custom-rewrite-rules/

    After implementing this line the &name ID then indeed changed to &fullname as per the code you posted. Unfortunately other charaters in the aweber url also changed rendering my php useless.

    This part of the Aweber url "&email=test%40" changes to email=test%2540. &name=Test%203 also changes to &fullname=email=test%2540

    This is my htaccess code that is located in my public_html folder.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/(account-activation) [NC]
    RewriteRule . /index.php [L]

    RewriteCond %{QUERY_STRING} (.+?)&name=(.+?)
    RewriteRule ^account-activation account-activation/?%1&fullname=%1 [R,NC,L]
    </IfModule>

    # END WordPress

    Is there more that I am missing.
    Please help

    Kind Regards
    Ian

  6. ianm7323
    Member
    Posted 3 years ago #

    Can anyone help?????

  7. kristarella
    Member
    Posted 3 years ago #

    Sorry for the delay Ian; really busy weekend...

    So for my fix:

    RewriteCond %{QUERY_STRING} (.+?)&name=(.+)
    RewriteRule ^page-name/ /page-name/?%1&fullname=%2 [R,NC,L]

    To implement it. The only thing you need to change in the code is page-name to the page that you are using Aweber code on. I have found that if you need to use it on multiple pages you need to repeat both lines of the code, not just the second line (not sure why this is, I don't have a deep knowledge of htaccess).

    Then in the code that you embed in the post from Aweber to display the signee's name you change "name" to "fullname".

    How it works: the code only activates when there is a URL that has a query string containing "&name=" (the rewrite condition) and it also fetches and stores all of the query string before and after that bit of the string (these are the two sections in parentheses). Then when it finds that condition in the URL with your page name it replaces the whole query string with what you tell it to replace, which is the bracketed section before "&name=" (specified by %1), then "&fullname=", then the second bracketed section (specified as %2).

    So, in your code you've got %1 twice, which is going to repeat the first part of the query string twice.
    I also put the code before the other WP stuff (after RewriteEngine On and before RewriteBase). I'm not really sure what effect that has, but it worked for me.

  8. rthurman
    Member
    Posted 3 years ago #

    So, I am getting past the 404 issue, but the sample script doesnt work on the page...any ideas?

  9. kristarella
    Member
    Posted 3 years ago #

    Can you give a link to the page? Or paste the code that isn't working here?

  10. rthurman
    Member
    Posted 3 years ago #

    <script type="text/javascript">
    var formData = function() {
    var query_string = (location.search) ? ((location.search.indexOf('#') != -1) ? location.search.substring(1, location.search.indexOf('#')) : location.search.substring(1)) : '';
    var elements = [];
    if(query_string) {
    var pairs = query_string.split("&");
    for(i in pairs) {
    if (typeof pairs[i] == 'string') {
    var tmp = pairs[i].split("=");
    elements[unescape(tmp[0])] = unescape(tmp[1]);
    }
    }
    }
    return {
    display: function(key) {
    if(elements[key]) {
    document.write(elements[key]);
    } else {
    document.write("<!--If desired, replace everything between these quotes with a default in case there is no data in the query string.-->");
    }
    }
    }

    }();

    </script>

    <script type="text/javascript">formData.display("email")</script>

    Test page:

    http://main.smallbusinesscommerceassociation.org/2010-sbca-best-of-business-award-step-2/?custom%2520award%2520code=123456789&custom%2520category=Test%2520Cat&custom%2520city=Test%2520City&custom%2520company=Test%2520Company&email=rich%255fthurman%2540hotmail%252ecom&from=rich%255fthurman%2540hotmail%252ecom&listname=sbcalist1&meta_adtracking=2010%255fsbca%255faward%255foptin&meta_message=1001&meta_required=name%2520%2528awf%255ffirst%2529%252cname%2520%2528awf%255flast%2529%252cemail%252ccustom%2520Company%252ccustom%2520Category%252ccustom%2520City%252ccustom%2520Award%2520Code&meta_split_id=&meta_tooltip=&meta_web_form_id=393435668&fullname=Rich%2520Turman&name%2520(awf_first)=Rich&name%2520(awf_last)=Turman&submit=Next

  11. rthurman
    Member
    Posted 3 years ago #

    I got it after inspecting the resulting HTML. There were extra line breaks in the script so WP out them in <p> tags so the closing script tag got munched.

    So...User error.....

    anyway...kristarella you are da Bombdiggity!!

    Thanks

    Rich

  12. kristarella
    Member
    Posted 3 years ago #

    Ah, goodo. Glad it's fixed!

  13. rthurman
    Member
    Posted 3 years ago #

    Thanks again....also sent you an add request on FB

    Rich

Topic Closed

This topic has been closed to new replies.

About this Topic