One of our users discovered a bug in the og2list code related to custom content types.
She created a news posting (using our custom news content type) and all that came through og2list for the message body was:
2
It turns out that og2list was using faulty logic to determine if something was a node or a comment. It was checking to see if $edit['body'] was set and assuming that if not, then this object is a comment:
function og2list_send_mail($edit) {
// .....
// Formatting
if (!isset($edit['body'])) { // comment posted
The other side of this if branch set the $body variable to $edit['comment']. All fine and dandy with default types, but in our case the custom type did not have a field named 'body' - it is named content_body_0. og2list was running the else side of the if branch and sending $edit['comment'] which contained the number 2. (not sure why this is).
Anwyay, in situations like this I always refer to "how og did it". In this case og was properly determining node vs. comment, and then using og_node_view() - a rewritten node_view() without the theme call at the end - to format the body. Although this may have worked at one time, it no longer does - so what I'm describing is a seperate bug that exists in og as well. I confirmed this by turning off og2list temporarily and creating a new news post, and og notified but included an empty body. og2list meanwhile is now sending "n/a" as the body, an improvement over "2" but not quite there.
I need to spend some more time early next week getting the body to be rendered properly in the e-mail body. Note that on the web site, all of these nodes are fine, it's just og2list's og2list_send_mail() and og's og_mail() that are not working properly... likely something that changed.
I did compare og's og_node_view() with node_view() from DRUPAL-5 and they are different, so there has been some convergence.
I will be fixing this on Monday hopefully and updating this issue with a patch.
Comments
Comment #1
damien_vancouver commentedRevisiting the patch queue I see this one is sitting there without a backport. This is fixed for us at Postcarbon, largely by copying the contents of node_view() into an _og2list_node_view() and calling that when the body contains '
n/a
'. This causes og2list to render the CCK type properly for the email.
At one point I had this turned on all the time, but it caused e-mails to inherit too much of the site theming; also as soon as someone replied, simple text exchanges between users ended up looking like heavy HTML and a mismatch of different e-mail client formatting.
Anyway the fix has been working for us consistently, I will create a backport that can be tested against HEAD.