1

When you go to the registration page of an event that uses a discount code from CiviDiscount, this error appears several times in a big red error box at the top. If you scroll down far enough the actual registration form does appear. We have recently upgraded from an earlier version of Civi to 4.6.9, and from Joomla to Drupal. We have upgraded the CiviDiscount extension to 3.1 after doing the upgrade and migration.

This error message is repeated:

Warning: array_keys() expects parameter 1 to be array, null given in CRM_CiviDiscount_DiscountCalculator->filterDiscountsByContact() (line 108 of /home/registrationrig/www/www/sites/default/files/civicrm/extensions/org.civicrm.module.cividiscount/CRM/CiviDiscount/DiscountCalculator.php). Warning: Invalid argument supplied for foreach() in CRM_CiviDiscount_DiscountCalculator->filterDiscountsByContact() (line 108 of /home/registrationrig/www/www/sites/default/files/civicrm/extensions/org.civicrm.module.cividiscount/CRM/CiviDiscount/DiscountCalculator.php).

  • pls update description with version of cividiscount – petednz - fuzion Oct 29 '15 at 22:49
  • CiviDiscount is 3.1. Thanks – Jane Caldwell Nov 2 '15 at 12:02
1

Beside having that big ugly message at the top, does it work properly?

This is a WARNING, that can either be a missing validation of something from the developer, and could safely be ignored, or showing you the root of the problem.

You mention moving from joomla to drupal, the issue might be that the link between a user (in the CMS) and her contact (in the CRM) aren't properly linked anymore. Is this warning displayed when you are authenticated or to an anonymous user?

Anyway, if the discount works as expected, a quick workaround is to change the php configuration so it doesn't display NOTICE or WARNING online (I disable displaying them in production, mostly because they tend to be too verbose and disclose information like the path where I installed civi for instance that I'd rather keep private, for security reason)

yo can change that by changing the default value or add a error_reporting line on your civicrm_settings.php http://php.net/manual/en/function.error-reporting.php

X+

| improve this answer | |
  • Yes, apart from having the horrible message it does work properly. No difference if the user is authenticated or anonymous. My user is actually re-created and properly linked in Drupal. Thanks for your help. I will try changing the php. – Jane Caldwell Nov 2 '15 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.