Cannot add mailing list recipient to group node once it has already created
damien_vancouver - June 15, 2007 - 19:12
| Project: | Organic groups list manager |
| Version: | HEAD |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | damien_vancouver |
| Status: | closed |
Description
One of my users discovered a bug in og2list (both HEAD and 4.7 branches). There is no code in hook_nodeapi() when $op='update' to process the 'recipient' ($node->og2list_ml) value, but the text box to enter it still appears when a node does not have a recipient set yet.
The attached patch goes into og2list_nodeapi() right after case 'update':
case 'update':
/* If the node previously did not have an address and one has just been assigned,
* then we need to set it now. If the node did have an og2list_groups row before
* then the recipient wasn't set and we update it. For now you still cannot change
* a recipient once it's set.
*/
if ($node->recipient &&
(db_num_rows(db_query("SELECT recipient FROM {og2list_groups} WHERE nid = %d",$node->nid)) == 0)) {
db_query("INSERT INTO {og2list_groups} (nid, recipient, status) "
. " VALUES(%d, '%s', 1)", $node->nid, $node->recipient);
}
// existing update logic continues hereThis allows the Mailing List Address field to be filled in if a list has not been set yet, but prevents og2list trying to insert it when the row already exists (and $node->recipient is a hidden value containing its address).
The attached patch is for HEAD. It should also apply to 4.7 but I'll attach a backported patch for DRUPAL-4-7 in a comment.
| Attachment | Size |
|---|---|
| og2list_edit_existing_group_add_recipient_HEAD.patch | 1.28 KB |

#1
Here is the patch again, for version 4.7-1.x in CVS.
#2
applied to both branches
#3