Signup status module adds a filter of recipients to the broadcast form which allows sending a message only to a subgroup of all signuped users. The patch would allow to reuse a signup_broadcast_form_submit() function from within a signup_status module.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 357655_signup_broadcast_api.4.patch | 7.04 KB | dww |
| #1 | 357655_signup_broadcast_api.1.patch | 2.24 KB | dww |
| s.diff | 725 bytes | miglius |
Comments
Comment #1
dwwIn principle, that's fine with me. However, the patch changed the arguments to the function and didn't update the PHPDoc comments about what was expected. Investigating exactly how that $addresses array was used made it clear that it was a poorly named variable. It should really be called $users, since it's an array of objects, not just an array of email addresses. See attached patch for what fields you need in this object to be able to use it in this function.
Comment #2
dwwUpon further discussion in IRC, we think it'd be better to just have an API function that was shared by all the relevant form submit handlers, instead of trying to reuse this particular submit handler. In addition to signup and signup_status, I was thinking it'd be nice to add a "send signup broadcast" action for VBO support (#352328: Replace (optionally?) node/N/signups/admin with a views bulk operations view?). So, the proposed new function would be:
I'll work on this is in a bit...
Comment #3
miglius commentedWould you mind changing sql in signup_get_email_addresses() function to following:
This way the sql would pick up the values of additional db columns added by other modules (signup_status for example) and the function could be reused.
Comment #4
dwwThat's a fine idea. I moved signup_get_email_addresses() into signup.module and renamed it to signup_get_signups(). I also fixed a PHP warning by grabbing the 'language' field from {users}, too, which we need when sending the emails. This also adds signup_send_broadcast() and fixes signup_broadcast_form_submit() to setup some arguments and just call that to do the real work. Tested with the broadcast form and it all seems to be fine, but if you wanted to review the new APIs to make sure they're what you need to use it outside of the broadcast form, that'd be great.
Comment #5
miglius commentedThis patch works nicely. I think it can be committed.
Comment #6
dwwGreat. Committed to HEAD and DRUPAL-6--1. Thanks for testing.