artfulrobot / uk.artfulrobot.civicrm.gocardless

A CiviCRM extension providing GoCardless integration to handle UK Direct Debits.
GNU Affero General Public License v3.0
5 stars 18 forks source link

Webhooks don't display correctly in WordPress #97

Closed wmortada closed 3 years ago

wmortada commented 3 years ago

Looking at the new settings page, the webhook URLs don't appear to be displaying correctly.

They look like: http://wpmaster.localhost:7979http://wpmaster.localhost:7979/civicrm/civicrm/payment/ipn/4/

Rather than: http://wpmaster.localhost:7979/civicrm/civicrm/payment/ipn/4/

Note that this appears to be an issue on WordPress. It works fine in Drupal 7 (haven't tried other CMSs).

I'm guessing this is due to this line of code. Not sure why CRM.url give a different result depending on CMS.

Testing on latest CiviCRM, Drupal and WordPress using Buildkit.

Brilliant to have these URLs in the settings page by the way. :smiley_cat:

artfulrobot commented 3 years ago

@wmortada could you test that ↑?

wmortada commented 3 years ago

Thanks for the response. Will take a look later in the week.

This feels more like an issue with CiviCRM core. Surely it should provide a consistent URL regardless of CMS?

wmortada commented 3 years ago

I've tested this in WordPress and it returns the expected URL with this patch: http://wpmaster.localhost:7979/civicrm/civicrm/payment/ipn/4/.

I've also tested in Drupal 7 and the URL remains unchanged as http://dmaster.localhost:7979/civicrm/payment/ipn/4.

So this appears to fix the issue. However, it does feel a bit unsatisfying to have to do this. I'll have a dig into CiviCRM to see if I can work out why this is inconsistent.

artfulrobot commented 3 years ago

Bless you @wmortada! That's great. Thanks for testing and for investigating. Nb. the CRM.url javascript function is very much a poorer cousin to the Smarty or PHP versions which offer front/back end, absolute/relative, HTML-safe etc. options.

wmortada commented 3 years ago

Thanks @artfulrobot. Posted a question here: https://civicrm.stackexchange.com/questions/38300/why-does-crm-url-give-different-results-in-wordpress-and-drupal