Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How to redirect to custom page after subscription ? WordPress

  • REFUNDED

Hi,

I am using wysija plugin (http://wordpress.org/plugins/wysija-newsletters/). After I click button "Subscribe", I want to be redirected to custom page. How to do this ? Can you can do it ?

This is my page: http://cheapproducts4you.com/test.html

Thank you very much !

Answers (4)

2013-09-20

Expert answers:

Find the ajax call inside http://cheapproducts4you.com/wp-content/plugins/wysija-newsletters/js/<strong>front-subscribers.js</strong> file and add the line window.location.href = window.location.href; /* you can put the custom url */ inside the ajax success.


i.ajax({
type: "post",
url: wysijaAJAX.ajaxurl,
data: wysijaAJAX,
success: function (t) {
i("#msg-" + n).html('<div class="allmsgs"></div>'), t.result || i("#" + n).fadeIn(), i.each(t.msgs, function (t, a) {
i("#msg-" + n + " .allmsgs ." + t + " ul").length || i("#msg-" + n + " .allmsgs").append('<div class="' + t + '"><ul></ul></div>'), i.each(a, function (a, l) {
i("#msg-" + n + " .allmsgs ." + t + " ul").append("<li>" + l + "</li>")
})
});
window.location.href = window.location.href; /* you can put the custom url */
},


kegiaumat055 comments:

jQuery(function(i){void 0===i.fn.on&&(i.fn.on=function(t,a,l,n){return"function"==typeof a?i(this.context).live(t,a):i(a).live(t,l,n),this}),i(document).on("click",".showerrors",function(){return i(".xdetailed-errors").toggle(),!1}),i(document).on("click",".shownotices",function(){return i(".xdetailed-updated").toggle(),!1}),i("form.widget_wysija").on("focus","input[placeholder]",function(){i(this).val()===i(this).attr("placeholder")&&i(this).val("")}),i("form.widget_wysija").on("blur","input[placeholder]",function(){""===i(this).val()&&i(this).val(i(this).attr("placeholder"))}),i("form.widget_wysija").on("focus","input.defaultlabels",function(){i(this).val()===i(this).attr("title")&&i(this).val("")}),i("form.widget_wysija").on("blur","input.defaultlabels",function(){""===i(this).val()&&i(this).val(i(this).attr("title"))}),i(document).on("submit","form.widget_wysija",function(t){if(t.preventDefault(),void 0!==wysijaAJAX.noajax)return i(this).validationEngine("validate");if(i(this).validationEngine("validate")===!0){var a=i(this).find('input[name="action"]').val(),l=i(this).find('input[name="controller"]').val(),n=i(this).attr("id"),s=i(this).serializeArray();wysijaAJAX.task=a,wysijaAJAX.controller=l,wysijaAJAX.formid=n,i.each(s,function(i,t){wysijaAJAX["data["+i+"][name]"]=t.name,wysijaAJAX["data["+i+"][value]"]=t.value}),i("#msg-"+n).html('<div class="allmsgs"><blink>'+wysijaAJAX.loadingTrans+"</blink></div>"),i("#"+n).fadeOut(),i.ajax({type:"post",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(t){i("#msg-"+n).html('<div class="allmsgs"></div>'),t.result||i("#"+n).fadeIn(),i.each(t.msgs,function(t,a){i("#msg-"+n+" .allmsgs ."+t+" ul").length||i("#msg-"+n+" .allmsgs").append('<div class="'+t+'"><ul></ul></div>'),i.each(a,function(a,l){i("#msg-"+n+" .allmsgs ."+t+" ul").append("<li>"+l+"</li>")})})},error:function(t,a,l){i("#msg-"+n).html('<div class="allmsgs"></div>'),i("#msg-"+n+" .allmsgs").html('<div class="error"><ul><li>Oops! There is a problem with this form:</li><li>textStatus:'+a+"</li><li>errorThrown:"+l+"</li><li>responseText:"+t.responseText+"</li></ul></div>")},dataType:"jsonp"})}return!1}),i(function(){i("form.widget_wysija").validationEngine("attach",{promptPosition:"centerRight",scroll:!1}),i("form.widget_wysija").bind("jqv.form.validating",function(){i(this).find("input[placeholder]").each(function(){i(this).val()===i(this).attr("placeholder")&&i(this).val("")})}),i("form.widget_wysija").find("input[placeholder]").each(function(){""===i(this).val()&&i(this).val(i(this).attr("placeholder"))}),i("form.widget_wysija").bind("jqv.form.validating",function(){i(this).find("input.defaultlabels").each(function(){i(this).val()===i(this).attr("title")&&i(this).val("")})}),i("form.widget_wysija").find("input.defaultlabels").each(function(){""===i(this).val()&&i(this).val(i(this).attr("title"))})})});

The front-subscribers.js file only contains 1 line. I add
window.location.href = window.location.href; /* you can put the custom url */
after
append("<li>"+l+"</li>")})})

But it doesn't work. How to add ? Thank you !


Expert comments:

Yes.. you have to un-minify the code and then add the redirection code. Or if you can send me the details I can have a look.


Expert comments:

1. Open the file cheapproducts4you.com/wp-content/plugins/wysija-newsletters/js/front-subscribers.js for editing. ( copy the file to your local system before hand as backup )
2. Simply replace all the code inside that file with below code. Then save the file.


jQuery(function(e){void 0===e.fn.on&&(e.fn.on=function(t,n,r,s){return"function"==typeof n?e(this.context).live(t,n):e(n).live(t,r,s),this}),e(document).on("click",".showerrors",function(){return e(".xdetailed-errors").toggle(),!1}),e(document).on("click",".shownotices",function(){return e(".xdetailed-updated").toggle(),!1}),e("form.widget_wysija").on("focus","input[placeholder]",function(){e(this).val()===e(this).attr("placeholder")&&e(this).val("")}),e("form.widget_wysija").on("blur","input[placeholder]",function(){""===e(this).val()&&e(this).val(e(this).attr("placeholder"))}),e("form.widget_wysija").on("focus","input.defaultlabels",function(){e(this).val()===e(this).attr("title")&&e(this).val("")}),e("form.widget_wysija").on("blur","input.defaultlabels",function(){""===e(this).val()&&e(this).val(e(this).attr("title"))}),e(document).on("submit","form.widget_wysija",function(t){if(t.preventDefault(),void 0!==wysijaAJAX.noajax)return e(this).validationEngine("validate");if(e(this).validationEngine("validate")===!0){var n=e(this).find('input[name="action"]').val(),r=e(this).find('input[name="controller"]').val(),s=e(this).attr("id"),o=e(this).serializeArray();wysijaAJAX.task=n,wysijaAJAX.controller=r,wysijaAJAX.formid=s,e.each(o,function(e,t){wysijaAJAX["data["+e+"][name]"]=t.name,wysijaAJAX["data["+e+"][value]"]=t.value}),e("#msg-"+s).html('<div class="allmsgs"><blink>'+wysijaAJAX.loadingTrans+"</blink></div>"),e("#"+s).fadeOut(),e.ajax({type:"post",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(t){e("#msg-"+s).html('<div class="allmsgs"></div>'),t.result||e("#"+s).fadeIn(),e.each(t.msgs,function(t,n){e("#msg-"+s+" .allmsgs ."+t+" ul").length||e("#msg-"+s+" .allmsgs").append('<div class="'+t+'"><ul></ul></div>'),e.each(n,function(n,r){e("#msg-"+s+" .allmsgs ."+t+" ul").append("<li>"+r+"</li>")})});window.location.href=window.location.href},error:function(t,n,r){e("#msg-"+s).html('<div class="allmsgs"></div>'),e("#msg-"+s+" .allmsgs").html('<div class="error"><ul><li>Oops! There is a problem with this form:</li><li>textStatus:'+n+"</li><li>errorThrown:"+r+"</li><li>responseText:"+t.responseText+"</li></ul></div>")},dataType:"jsonp"})}return!1}),e(function(){e("form.widget_wysija").validationEngine("attach",{promptPosition:"centerRight",scroll:!1}),e("form.widget_wysija").bind("jqv.form.validating",function(){e(this).find("input[placeholder]").each(function(){e(this).val()===e(this).attr("placeholder")&&e(this).val("")})}),e("form.widget_wysija").find("input[placeholder]").each(function(){""===e(this).val()&&e(this).val(e(this).attr("placeholder"))}),e("form.widget_wysija").bind("jqv.form.validating",function(){e(this).find("input.defaultlabels").each(function(){e(this).val()===e(this).attr("title")&&e(this).val("")})}),e("form.widget_wysija").find("input.defaultlabels").each(function(){""===e(this).val()&&e(this).val(e(this).attr("title"))})})})



Now this should work !! Let me know if it does work.


kegiaumat055 comments:

Thank ! It works


kegiaumat055 comments:

If plugin is updated, how to fix it ?

2013-09-20

Eric P. answers:

What is the exact url you want to go to after the subscription is successful?


Eric P. comments:

Using the attached file (save/ftp it to wp-content/plugins/wysija-newsletters/js/front-subscribers.js), you should see the url change to "http://cheapproducts4you.com/#subscribed" after subscription.

Look in the file and you'll see that actual URL.. Change the URL between the quote marks to whatever URL you want to redirect to after a successful subscription.


Eric P. comments:

It's not showing the file, and it's not letting me edit my last response, either. The front-subscriber.js file I was sending was this:
jQuery(function(i){void 0===i.fn.on&&(i.fn.on=function(t,a,l,n){return"function"==typeof a?i(this.context).live(t,a):i(a).live(t,l,n),this}),i(document).on("click",".showerrors",function(){return i(".xdetailed-errors").toggle(),!1}),i(document).on("click",".shownotices",function(){return i(".xdetailed-updated").toggle(),!1}),i("form.widget_wysija").on("focus","input[placeholder]",function(){i(this).val()===i(this).attr("placeholder")&&i(this).val("")}),i("form.widget_wysija").on("blur","input[placeholder]",function(){""===i(this).val()&&i(this).val(i(this).attr("placeholder"))}),i("form.widget_wysija").on("focus","input.defaultlabels",function(){i(this).val()===i(this).attr("title")&&i(this).val("")}),i("form.widget_wysija").on("blur","input.defaultlabels",function(){""===i(this).val()&&i(this).val(i(this).attr("title"))}),i(document).on("submit","form.widget_wysija",function(t){if(t.preventDefault(),void 0!==wysijaAJAX.noajax)return i(this).validationEngine("validate");if(i(this).validationEngine("validate")===!0){var a=i(this).find('input[name="action"]').val(),l=i(this).find('input[name="controller"]').val(),n=i(this).attr("id"),s=i(this).serializeArray();wysijaAJAX.task=a,wysijaAJAX.controller=l,wysijaAJAX.formid=n,i.each(s,function(i,t){wysijaAJAX["data["+i+"][name]"]=t.name,wysijaAJAX["data["+i+"][value]"]=t.value}),i("#msg-"+n).html('<div class="allmsgs"><blink>'+wysijaAJAX.loadingTrans+"</blink></div>"),i("#"+n).fadeOut(),i.ajax({type:"post",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(t){i("#msg-"+n).html('<div class="allmsgs"></div>'),t.result||i("#"+n).fadeIn(),i.each(t.msgs,function(t,a){i("#msg-"+n+" .allmsgs ."+t+" ul").length||i("#msg-"+n+" .allmsgs").append('<div class="'+t+'"><ul></ul></div>'),i.each(a,function(a,l){i("#msg-"+n+" .allmsgs ."+t+" ul").append("<li>"+l+"</li>")})window.location.href="http://cheapproducts4you.com/#subscribed"})},error:function(t,a,l){i("#msg-"+n).html('<div class="allmsgs"></div>'),i("#msg-"+n+" .allmsgs").html('<div class="error"><ul><li>Oops! There is a problem with this form:</li><li>textStatus:'+a+"</li><li>errorThrown:"+l+"</li><li>responseText:"+t.responseText+"</li></ul></div>")},dataType:"jsonp"})}return!1}),i(function(){i("form.widget_wysija").validationEngine("attach",{promptPosition:"centerRight",scroll:!1}),i("form.widget_wysija").bind("jqv.form.validating",function(){i(this).find("input[placeholder]").each(function(){i(this).val()===i(this).attr("placeholder")&&i(this).val("")})}),i("form.widget_wysija").find("input[placeholder]").each(function(){""===i(this).val()&&i(this).val(i(this).attr("placeholder"))}),i("form.widget_wysija").bind("jqv.form.validating",function(){i(this).find("input.defaultlabels").each(function(){i(this).val()===i(this).attr("title")&&i(this).val("")})}),i("form.widget_wysija").find("input.defaultlabels").each(function(){""===i(this).val()&&i(this).val(i(this).attr("title"))})})});


kegiaumat055 comments:

I change my file by your code. But it doesn't work.


Eric P. comments:

Your site isn't working as a WordPress site at all now.

Can you go back (to a backup if necessary, or a fresh install). Install the wysija-newsletter plugin, and leave it unchanged. I'll install and test on my own test WordPress test site, and send you the updated file when I'm sure it works.


kegiaumat055 comments:

Hi,

No, I am using Wordpress. My html page is using html code of wysija-newsletter plugin.

2013-09-26

Hariprasad Vijayan answers:

Hi,

Can you update the following code in http://cheapproducts4you.com/wp-content/plugins/wysija-newsletters/js/front-subscribers.js
jQuery(function(i){void 0===i.fn.on&&(i.fn.on=function(t,a,l,n){return"function"==typeof a?i(this.context).live(t,a):i(a).live(t,l,n),this}),i(document).on("click",".showerrors",function(){return i(".xdetailed-errors").toggle(),!1}),i(document).on("click",".shownotices",function(){return i(".xdetailed-updated").toggle(),!1}),i("form.widget_wysija").on("focus","input[placeholder]",function(){i(this).val()===i(this).attr("placeholder")&&i(this).val("")}),i("form.widget_wysija").on("blur","input[placeholder]",function(){""===i(this).val()&&i(this).val(i(this).attr("placeholder"))}),i("form.widget_wysija").on("focus","input.defaultlabels",function(){i(this).val()===i(this).attr("title")&&i(this).val("")}),i("form.widget_wysija").on("blur","input.defaultlabels",function(){""===i(this).val()&&i(this).val(i(this).attr("title"))}),i(document).on("submit","form.widget_wysija",function(t){if(t.preventDefault(),void 0!==wysijaAJAX.noajax)return i(this).validationEngine("validate");if(i(this).validationEngine("validate")===!0){var a=i(this).find('input[name="action"]').val(),l=i(this).find('input[name="controller"]').val(),n=i(this).attr("id"),s=i(this).serializeArray();wysijaAJAX.task=a,wysijaAJAX.controller=l,wysijaAJAX.formid=n,i.each(s,function(i,t){wysijaAJAX["data["+i+"][name]"]=t.name,wysijaAJAX["data["+i+"][value]"]=t.value}),i("#msg-"+n).html('<div class="allmsgs"><blink>'+wysijaAJAX.loadingTrans+"</blink></div>"),i("#"+n).fadeOut(),i.ajax({type:"post",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(t){location = 'http://cheapproducts4you.com/';i("#msg-"+n).html('<div class="allmsgs"></div>'),t.result||i("#"+n).fadeIn(),i.each(t.msgs,function(t,a){i("#msg-"+n+" .allmsgs ."+t+" ul").length||i("#msg-"+n+" .allmsgs").append('<div class="'+t+'"><ul></ul></div>'),i.each(a,function(a,l){i("#msg-"+n+" .allmsgs ."+t+" ul").append("<li>"+l+"</li>")})})},error:function(t,a,l){i("#msg-"+n).html('<div class="allmsgs"></div>'),i("#msg-"+n+" .allmsgs").html('<div class="error"><ul><li>Oops! There is a problem with this form:</li><li>textStatus:'+a+"</li><li>errorThrown:"+l+"</li><li>responseText:"+t.responseText+"</li></ul></div>")},dataType:"jsonp"})}return!1}),i(function(){i("form.widget_wysija").validationEngine("attach",{promptPosition:"centerRight",scroll:!1}),i("form.widget_wysija").bind("jqv.form.validating",function(){i(this).find("input[placeholder]").each(function(){i(this).val()===i(this).attr("placeholder")&&i(this).val("")})}),i("form.widget_wysija").find("input[placeholder]").each(function(){""===i(this).val()&&i(this).val(i(this).attr("placeholder"))}),i("form.widget_wysija").bind("jqv.form.validating",function(){i(this).find("input.defaultlabels").each(function(){i(this).val()===i(this).attr("title")&&i(this).val("")})}),i("form.widget_wysija").find("input.defaultlabels").each(function(){""===i(this).val()&&i(this).val(i(this).attr("title"))})})});

Let me know


Hariprasad Vijayan comments:

Keep a backup of that file.


Hariprasad Vijayan comments:

is it works for you?


kegiaumat055 comments:

Hi,

The present box is very bare and naked. How to make it more attracted ?

Thank you !

2013-09-25

Balanean Corneliu answers:

I have instaled this plugin wysija and i use from a widget position on frontpage, After I click button "Subscribe", i get the message Check your email for the activation.
You need to be redirected after this or at you are not working the same?