Consider specifying the $frontend argument as true in getNotifyUrl()
While working on migrating our CiviCRM instance from Drupal to Wordpress, I discovered that the notification URL for test contribution IPNs was being set to the backend in Wordpress (StackExchange link for reference).
The solution to this was to specify that the $frontend
argument be set to TRUE
in the call to the CRM_Utils_System::url
method made in getNotifyUrl()
in the payment module (code link).
For a quick visual, here is the before:
protected function getNotifyUrl() {
$url = CRM_Utils_System::url(
'civicrm/payment/ipn/' . $this->_paymentProcessor['id'],
array(),
TRUE,
NULL,
FALSE
);
return (stristr($url, '.')) ? $url : '';
}
and after:
protected function getNotifyUrl() {
$url = CRM_Utils_System::url(
'civicrm/payment/ipn/' . $this->_paymentProcessor['id'],
array(),
TRUE,
NULL,
FALSE,
TRUE // This is the $frontend argument
);
return (stristr($url, '.')) ? $url : '';
}
Extremely cursory testing seems to indicate that having this set doesn't adversely affect Drupal implementations, but the testing was just that, extremely cursory (I basically made the change temporary on our production Drupal installation and was able to make a test contribution). But for safety, I'm presuming there's a way to do a check for the CMS, and if it's Joomla or Wordpress, set it as TRUE
.
Ultimately, I wanted to open this issue for those who are much smarter than I to consider making this change in the getNotifyUrl
method definition.