Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem
When a registered and logged in user accepts an invitation through invite/accept/%invite_by_code
it receives an almost identical status message two times:
You have accepted the invitation from …
You have accepted the invitation from …
Only a period is missing from one of them. First from invite_invite_update()
, then from invite_accept()
, just at the end of the page callback (which invoked its own hook_invite_update()
).
Proposed resolution
Two (three) possible ways to fix this …
- Remove the message from one of these functions.
- Make messages equal (period missing in one of them) and use
drupal_set_message($msg, 'status', FALSE) which will omit duplicates.
- (Remove the message from the other function.) What function to remove from someone with more insight should decide.
I've provided two patches that solves this one or the other way. Please review.
Comment | File | Size | Author |
---|---|---|---|
invite-duplicate-messages-fix-2.patch | 1.48 KB | kaare | |
invite-duplicate-messages-fix-1.patch | 557 bytes | kaare |
Comments
Comment #1
markus_petrux CreditAttribution: markus_petrux commentedFix 2 works like a charm, and it looks nicer than 1. Thanks!
Comment #2
David_Rothstein CreditAttribution: David_Rothstein at Tag1 Consulting commentedFix 1 actually makes more sense to me (and is simpler), plus it seems to work fine also.
The code right above it saves the invite, and since the invite is being accepted that save should be guaranteed to trigger the code in invite_invite_update() that sets the message. Therefore setting the message in invite_accept() also should never be necessary.
Comment #3
ckng3rd one should do it. Committed to dev.