CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Redirect loop error when submitting contributions
Pages: [1] 2

Author Topic: Redirect loop error when submitting contributions  (Read 3235 times)

provanca

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.5.3
  • CMS version: WordPress 4.0.1
  • MySQL version: 5.5.32
  • PHP version: 5.3.28
Redirect loop error when submitting contributions
November 04, 2014, 05:31:23 am
Our main donation page is throwing a redirect loop error when the user clicks on "Confirm Contribution" after filling in their contact info and donation amount. The URL:

http://www.<mysite>.org/get-involved/donate/?page=CiviCRM&q=civicrm/contribute/transact

...redirects to:

http://www.<mysite>.org/get-involved/donate/?page=CiviCRM&q=civicrm/contribute/transact&

...which redirects back to the first, and so on.

The error does not occur if I am logged into Wordpress with a user account linked to a CiviCRM contact. But if I am submitting a donation as a guest then it throws the error every time.

Any ideas?

provanca

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.5.3
  • CMS version: WordPress 4.0.1
  • MySQL version: 5.5.32
  • PHP version: 5.3.28
Re: Redirect loop error when submitting contributions
November 07, 2014, 09:07:03 pm
Looks like it was related to 4.5.2. I just updated to 4.5.3, and I can no longer reproduce the problem.

And... it's back. No idea what changed in the last 24 hours, but the same tests that ran clean immediately after the upgrade are now failing. I'm again seeing the problem as described in the original post. Any advice appreciated - I'm not sure where to start.
« Last Edit: November 08, 2014, 08:23:11 pm by provanca »

sjmcguire

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.5.4
  • CMS version: Wordpress
  • MySQL version: 5.6.57
  • PHP version: 5.4.35
Re: Redirect loop error when submitting contributions
December 14, 2014, 07:18:43 am
Did you figure this out? I am having the same problem. I will post a new thread but wanted to bump you first to see if you found a solution.

provanca

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.5.3
  • CMS version: WordPress 4.0.1
  • MySQL version: 5.5.32
  • PHP version: 5.3.28
Re: Redirect loop error when submitting contributions
December 15, 2014, 06:34:42 am
Never figured it out. We eventually went to a donate button that takes donors straight to PayPal. It's a poor fix since we have to manually pull the data back into CiviCRM, so please post if you find a solution.

haystack

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 2
  • CiviCRM version: 4.n
  • CMS version: WordPress 4.n
  • MySQL version: 5.n
  • PHP version: 5.n
Re: Redirect loop error when submitting contributions
December 15, 2014, 02:56:06 pm
provanca, are you using the Paypal Sandbox? I've seen this behaviour when I was not logged in to Paypal whilst using the Sandbox.

provanca

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.5.3
  • CMS version: WordPress 4.0.1
  • MySQL version: 5.5.32
  • PHP version: 5.3.28
Re: Redirect loop error when submitting contributions
December 15, 2014, 04:01:11 pm
No, this is our main outward-facing donation page. It is using our live PayPal account.

haystack

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 2
  • CiviCRM version: 4.n
  • CMS version: WordPress 4.n
  • MySQL version: 5.n
  • PHP version: 5.n
Re: Redirect loop error when submitting contributions
December 16, 2014, 01:55:52 am
I found setting Paypal up on Civi very fiddly indeed. So many variables, so many settings. You may have to go through your settings very carefully and cross-check against the wiki:
http://wiki.civicrm.org/confluence/display/CRMDOC/PayPal+Website+Payments+Standard+and+Recurring+Contributions

Also check your .htaccess file (or httpd.conf) to make sure there aren't any redirects happening there and that your domains match exactly. Other than that, it's hard to imagine what's up with your install.

EranSch

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 3
    • Personal Blog
  • CiviCRM version: 4.5.X
  • CMS version: 4.X
  • MySQL version: 5.5.X
  • PHP version: 5.5.X
Re: Redirect loop error when submitting contributions
December 22, 2014, 10:44:26 am
I've been dealing with the same issue for some time now except during testing the CiviCRM Stripe extension. The developer of the extension and I have gone back and forth for some time trying to resolve the issue.

https://github.com/drastik/civicrm_stripe/issues/62

Oddly, I've just encountered the redirect loop issue with a simple frontend 'Edit' profile. When submitting the form, the following requests are made...

  • ?page=CiviCRM&q=civicrm/profile/edit
  • ?page=CiviCRM&q=civicrm/profile/edit&
  • ?page=CiviCRM&q=civicrm/profile/edit
  • ?page=CiviCRM&q=civicrm/contribute/transact&page=CiviCRM <- loops infinitely

The issue with Civicrm-Stripe seemed to have to do with the path used for redirects on errors however this problem seems really bizarre as the CiviCRM path changes from profile/edit to a contribution when the profile in question doesn't even involve a contribution.

joelcomit

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • Owner/Designer/Developer at Comit Strategies
    • Comit Strategies
  • CiviCRM version: 4.5.5
  • CMS version: WordPress 4.1
  • MySQL version: 10.0.14-MariaDB
  • PHP version: 5.4.34
Re: Redirect loop error when submitting contributions
December 29, 2014, 08:39:31 am
I'm just going to add on that I'm having the same issue. Logged in users can make contributions fine. However, those not logged on are hitting a redirect error. URL arguments appear to be truncated after lgbtvadem.org/join/?page=CiviCRM&q=civicrm/contribute/transact&.

EranSch

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 3
    • Personal Blog
  • CiviCRM version: 4.5.X
  • CMS version: 4.X
  • MySQL version: 5.5.X
  • PHP version: 5.5.X
Re: Redirect loop error when submitting contributions
December 29, 2014, 10:34:14 am
Very strange. I wish I were more of a Civi pro and could delve into this.

Oddly, I found that if I overrode the default form submission and instead submitted the profile via AJAX, that it would save correctly.

For the time being, I'm going to have to stick with this as a hack. It's ugly but... oh well.

haystack

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 2
  • CiviCRM version: 4.n
  • CMS version: WordPress 4.n
  • MySQL version: 5.n
  • PHP version: 5.n
Re: Redirect loop error when submitting contributions
December 30, 2014, 04:34:29 am
Quote from: EranSch on December 22, 2014, 10:44:26 am
Oddly, I've just encountered the redirect loop issue with a simple frontend 'Edit' profile. When submitting the form, the following requests are made...

Can you give details on how to reproduce this? I can't seem to...

EranSch

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 3
    • Personal Blog
  • CiviCRM version: 4.5.X
  • CMS version: 4.X
  • MySQL version: 5.5.X
  • PHP version: 5.5.X
Re: Redirect loop error when submitting contributions
December 30, 2014, 06:06:46 am
Hey heystack,

The situation turns out to be a little more strange. The same profile placed on a different page (using the same WP shortcode) seems to work correctly.

The page in which I'm running into problems has quite a lot going on however I have yet to determine what the issue is stemming from. Strangely POSTing the form to the same URL with a jQuery AJAX request works fine.

At this point I'm presuming that my particular issue stems from something in my own environment however I can't speak for the others in this thread.

EranSch

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 3
    • Personal Blog
  • CiviCRM version: 4.5.X
  • CMS version: 4.X
  • MySQL version: 5.5.X
  • PHP version: 5.5.X
Re: Redirect loop error when submitting contributions
December 30, 2014, 11:17:56 am
Quote from: haystack on December 30, 2014, 04:34:29 am
Can you give details on how to reproduce this? I can't seem to...

I pinned down the source of my issue, it's a little abstract though, so may not be worth much though.  Basically, via a custom plugin the [civicrm] shortcode was being executed early on in the WP event stack. This was part of a hack to get CiviCRM to load the JS global on a page, if I recall correctly.

If you want to reproduce this error, add the following to a plugin or mu-plugin:

Code: [Select]
add_action( 'wp_enqueue_scripts', function(){
echo do_shortcode('[civicrm]');
});

Then, add any old profile to a given page in edit mode...

Code: [Select]
[civicrm component="profile" gid="{whatever}" mode="edit"]

Now when attempting to save the profile from the frontend, you should get the redirect loop.

FWIW, it seems that this issue doesn't come into play when two [civicrm] shortcodes are included on a single page. Thus, it's probably not of much concern. 

haystack

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 2
  • CiviCRM version: 4.n
  • CMS version: WordPress 4.n
  • MySQL version: 5.n
  • PHP version: 5.n
Re: Redirect loop error when submitting contributions
December 30, 2014, 01:50:09 pm
Not abstract at all to me, thanks for sharing. I can see what your mu-plugin is trying to do - i.e. force the parsing of an empty shortcode in order to trigger CRM_Core_Resources::singleton()->addCoreResources();. It would probably have been simpler just to call the Civi code directly, of course, but this situation (amongst others) is one of the reasons for a rewrite of the civicrm-wordpress plugin.

I don't know how technical you are, but if you're interested and have time, you might like to take a look at:
https://github.com/christianwach/civicrm-wordpress/tree/merged

This is basically the 4.6 plugin (plus a few extra fixes) that you can see on the master branch of:
https://github.com/civicrm/civicrm-wordpress

There is a fairly comprehensive description of what's going on here (you can ignore the fact that this refers to another branch!):
https://github.com/christianwach/civicrm-wordpress/tree/hooks#hooks-branch-instructions

One last thing: if you want page titles to appear correctly, you'll need to patch CiviCRM core with:
https://github.com/civicrm/civicrm-core/commit/29635f0a53a708f7c81085020cbb85525924ff11

Once this is done (it works just fine with 4.5.n and probably 4.4.n) your mu-plugin should become obsolete, since all shortcodes are rendered before the templating phase of the WordPress stack is reached and CRM_Core_Resources::singleton()->addCoreResources(); is automatically called at the right time.

Would be great to have other WordPress developers testing this out and chiming in!
« Last Edit: December 30, 2014, 01:59:31 pm by haystack »

EranSch

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 3
    • Personal Blog
  • CiviCRM version: 4.5.X
  • CMS version: 4.X
  • MySQL version: 5.5.X
  • PHP version: 5.5.X
Re: Redirect loop error when submitting contributions
January 01, 2015, 08:47:53 am
Cool!

Thanks for all the insight.

That was exactly the goal. I've been learning Civi from the ground up and mostly trial and error. The addCoreResources() method was exactly what I would have been looking for!! As it turns out, I moved beyond using the JS API anyway and wrote my own WP JSON API controllers for my needs.

While not being a CiviCRM pro by any means, I'm a bit of a WordPress geek so I'd be lying if I said I haven't been following your work. Your Hooks implementation was quite interesting as that was one of the first problems I had with Civi's hooks is that they don't quite follow the traditional WP action model.

My involvement with CiviCRM has been so deadline driven that I haven't been able to contribute much to Core. That said, I'd be in to testing the WP Integration code as that might be a little more within my abilities. Can I test your branch of the integration plugin while running the currently 4.5.5 release or do I need to be using 4.6 alpha?

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Redirect loop error when submitting contributions

This forum was archived on 2017-11-26.