Withdrawn invites count towards the limit
Bevan - June 12, 2009 - 06:12
| Project: | Invite |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
If a user can only send 1 invite, has sent one invite, then withdrawn it, they can not send any more invites, because invite_get_remaining_invites() counts withdrawn invites too.
Is this by design? If so, then we should add an setting for withdrawn invites NOT to be included in the count.
The following diff for invite.module fixes this issue on the assumption that this is a bug, not by design;
@@ -632,7 +629,7 @@ function invite_get_remaining_invites($a
if ($remaining > 0) {
// Legacy support.
- $sent = db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d", $account->uid));
+ $sent = db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND canceled < 1", $account->uid));
$remaining = max($remaining - $sent, 0);
if ($sent > 0) {
// Update user property for faster lookup next time.
#1
I can work on a patch for this over the next few days but need to know the right way forward.
#2
#3
my version, because your version didn't work. and I think a setting to exclude canceled invites is a good idea.
#4
I think my patch in #2 is probably dependent on the resolution of #197989: Retroactively change invitation limits proposed in comment #7 (or equivalent) there.