Problem changing the parent group for a node I am trying to programmatically update the parent group of a bunch of nodes. But I am not having much luck. Below is what I have tried. What am I doing wrong here?

foreach ($groups AS $group)
{
  $node = node_load($group-&gt;nid);
  $node-&gt;og_parent = 23; //I also tried "$node-&gt;og_parent = array('nid' =&gt; 23);"
  node_save($node);
  unset($node);
}


One thing to note is that all of these groups already have a parent group set. Also this is on Drupal 6.

Thanks!
Ok, I figured this out. Here is what I had to do.

I had to address this slightly differently. I just had to change $node-&gt;og_parent = 23; to $node-&gt;og_parent-&gt;nid = 23;.

I just had to address the specific node id and that fixed it.