Any plans about porting to D7?

Comments

Refineo’s picture

subscribing

Refineo’s picture

Issue tags: +d7 ports

adding d7 ports tag

julianmancera’s picture

This port may need a new module due to the need to changed the audience to entities, it can be called OG Audience by entity type

Julian Mancera

ZetaTrooper’s picture

Has there been any update on this or some other solution for this problem with OG in D7? I can't seem to find a solution to this problem in D7. This seems like a pretty major hole in the module.

nathanhilbert’s picture

I still wasn't able to find. I was previously using madhatter23's module in D6. It would be nice if this was ported to D7, but until then, we can accomplish limiting audience by group type with the following code.

function og_post_into_group_types_form_alter(&$form, &$form_state, $form_id) {

  if (isset($form['#node_edit_form']) && $form['#node_edit_form']) {
    $node = $form['#node'];
    if (isset($form['group_audience'])){
      // if $node->type == "some content type" do...
      $gids= og_post_into_group_types_all_groups_with_type("groups");
      foreach($form['group_audience']['und']['#options'] as $key=>$value){
        if (! in_array($key, $gids)){
          unset($form['group_audience']['und']['#options'][$key]);
        }
      }
    }
  }
}
function og_post_into_group_types_all_groups_with_type($select) {
//key points to types of groups that should be selected for the specific group type
  $options = array( "groups" => array("groupcontent type 1", "group content type 2"));

    $results = db_query("SELECT og.gid, content_access.group_content_access_value as content_access FROM og LEFT JOIN node ON og.etid=node.nid WHERE node.type IN (:options)", array(":options"=>$options[$select]))->fetchCol();
    return ($gids);
}