Hey gang,
Came across an interesting one.
Trying to make a mail list/forum for an organic group on a 4.7.2 site.
latest 4.7 of both og and mailhandler.. og.basic active.
Create test group. create test user for bouncing the email with email in their box from mailing list. this user is a member of the intranet group..
the node id for the group is 1, taxonomy term for the forum is 2.
Create mailbox in mailhandler. give incoming mail the following commands:
og_groups: [1]
type: forum
tid: 2

NOTE: this WORKS everytime in 4.6
This is BROKEN in 4.7...
what happens is that in the node_access table, the gid is always zero.
og_subscriber is given correctly as the realm, as are the nid and the permissions... but gid is always 0.. therefore the forum node created never shows up in the group.. and this is not good.

please help!
thanks!
ryan..

Comments

Veggieryan’s picture

Egon Bianchet’s picture

Status: Active » Closed (duplicate)

I'm marking it duplicate ...

stefan_seefeld’s picture

Version: 4.7.x-1.x-dev » 5.x-3.1
Status: Closed (duplicate) » Active

I'm unable to bind mailhandler to my OG forum. Since I'm using drupal 5, I assume
the best way to report the issue is by reactivating this issue. Please let me know
if there are other ways to do this.

For reference, I also reported this as an OG forum issue (though after some research
it looks as if it really belongs here):

http://drupal.org/node/164864

Thanks,

stefan_seefeld’s picture

Title: 4.7 broke mailhandler connection to OG! » 5.x broke mailhandler connection to OG!

I changed the title to reflect the version this issue (now) occurs in, and to attract a bit
more attention. Sorry if I can't try to attempt to port the patch that went into the 4.7 version.
I'm not a php (or drupal) developer.

Any help on this would be highly appreciated, as I'd like to use drupal for a new community
website I want to build, but this issue is a real blocker right now.

Thanks

moshe weitzman@drupal.org’s picture

Title: 5.x broke mailhandler connection to OG! » Write a hook_mailhandler so posts may be sent via email
Category: bug » feature

This will require someone to write some code to ttranslate the Command into a $node->og_groups array. Feature request.

stefan_seefeld’s picture

Here is a function I threw together. It should do what you suggest. Still no joy.
(I checked and made sure the og_groups array is correctly set to the node.)
Any suggestion on how to debug this ? What og functions are supposed to be
called, and where is decided whether the node will end up in an og_forum ?

/**
 * Implementation of hook_mailhandler. Scan mailhandler commands for
 * og-specific commands (notably: og_groups).
 *
 * @return node
 */
function og_mailhandler($node, $result, $i, $header, $mailbox)
{
  $lines = explode("\n", $mailbox['commands']);
  for ($i = 0; $i < count($lines); $i++)
  {
    $line = trim($lines[$i]);
    $words = explode(' ', $line);
    if (substr($words[0], -1) == ':' && is_null($endcommands))
    {
      // Looks like a name: value pair
      $data = explode(': ', $line, 2);
      // look for og_groups here
      if ($data[0] == 'og_groups')
      {
        // create array
        if (substr($data[1], 0, 1) == '[' && substr($data[1], -1, 1) == ']')
        {
          $data[1] = rtrim(ltrim($data[1], '['), ']'); //strip brackets
          $data[1] = explode(",", $data[1]);
        }
        $node->og_groups = $data[1];
        break;
      }
    }
    else 
    {
      if (is_null($endcommands)) $endcommands = $i;
    }
  }
  return $node;
}
stefan_seefeld’s picture

Ping ?

I'd really like to get this regression fixed, as my using drupal will depend on it. While I'd really like to
work on it, I feel I'm stubling in the dark right now. Could you please help me by outlining the typical
call graph / control flow for new nodes that are to be inserted somewhere into an organic group
(and in particular, into a og-specific forum) ?

Many thanks !

stefan_seefeld’s picture

I believe I have 'solved' the issue:

It turns out the og_groups attribute is already set by the mailhandler module itself; there is no need
to provide an og_mailhandler hook to do it again. However, for some reason I also have to specify
a 'taxonomy' comment (an array containing the terms I want the to be created node to be associated
with). I had used 'tid' before (which I found in some online docs). It could be that 'tid' has been
obsoleted by 'taxonomy' in the transition from 4.x to 5.x ?

So, the remaining issue is: "this needs documentation !" :-)

Thanks,

artatac’s picture

Hi Stefan

I have tried to follow your solution and although it always publishes to the site it ignores the OG setting. as the og group is at /node/36/edit I have tried:
pass: xxxxx
promote: 0
status: 1
og_groups: 36
tid: 2
type: article
taxonomy: [Website]

but I have also tried og_groups: [36] og_groups: 0 og_groups: 1 all with no luck. I wondered what is working for you? and what I am missing

Regards

Joe

challer’s picture

+1
I'm having the same issues and would love to know how to fix this,
Cheers, Chris

moshe weitzman’s picture

Status: Active » Closed (duplicate)

I articulated the mailhandler change i want which will make this possible: http://drupal.org/node/136606#comment-664183. lets discuss there.

challer’s picture

Sounds good, I'm more than happy to help test it