We just setup our first coupon for a membership product and on checkout received the error: 'Your user ID is not allowed to use this coupon.'
The coupon module allows you to set "User Restrictions" so that only particular usernames can use the coupon. We were not using this feature, but the module was saving blank 'User' data each time we saved the form which was causing the error.
Line 497:
foreach ($form_state['values']['users'] as $username) {
$data['users'][] = $username;
}
We changed this to:
foreach ($form_state['values']['users'] as $username) {
if (trim($username) != '') {
$data['users'][] = $username;
}
}
This resolves the error for us with no loss in the intended functionality of the feature.
Can someone please test this on their setup?
Thanks,
Rachel
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | avoids_empty_stings_in_coupon_usernames-2597604-3.patch | 806 bytes | s.messaris |
Comments
Comment #2
Farreres commentedNo idea, I am not using coupons...
Comment #3
s.messaris commentedI got the same issue, here is a patch I wrote based on your solution. It seems to work fine.
Comment #4
Tavorick commentedI can confirm this solution works.
Comment #5
s.messaris commentedComment #6
Farreres commented@s.messaris: I suppose all these patches should be added to devel, yes? Noone did this already?