1
votes

On my site I have set two Content Types as Organic Group nodes.

  1. Sports Group
  2. Education Group

There are also various other content types on the site, set to be standard group posts.To allows users to post content into groups, which then references that group.

I have then enabled the Group Details block to show on each group, which then shows create content links to each content types that = standard group post.

What I would like to do, whether its done with that block or I create my own is to limit certain content type creation links to certain groups. i.o.w I don't want to allow certain content types to be created in the Sports Group. I think this can be done with a custom menu or block, but unsure of the PHP required.

1

1 Answers

1
votes

Found a way to create manual menus by using blocks.

Follow the follwoing link which explains it all - http://drupal.org/node/169126

Below is the text from the link:


Here's what I put together from all of this.... To create links from a group page to create content that is automatically assigned to that group... The code below was put into a block with formatting set to php

<?php $group_title = og_get_group_context()->title; ?>
<h2>You are a member of the <?php print $group_title; ?> group </h2>
<?php $group_nid = og_get_group_context()->nid; ?>
<div class="user-input-link"><a href="http://your-site/node/add/your-content-type?gids[]=<?php print $group_nid; ?>">Post your own content-type into this group.</a>
</div>

And it works!

Now you need to have it show up on group pages and only if the user is a member of that group. So in the "show block" section you can put this in and it seems to work:

<?php
  $in_og = FALSE;
if (module_exists('og')){
  $in_og = FALSE;
  $group_node = og_get_group_context();
  $gid02 = $group_node->nid;
  $gid = (int)$gid02;
  if ($gid02 == null) $gid = 0; 
  if (og_is_group_member($group_node)) $in_og = TRUE;
  if ($gid == 0) $in_og = FALSE;
}
return $in_og;

?>