You are here

function og_og_create_links in Organic groups 5.2

Same name and namespace in other branches
  1. 5.8 og.module \og_og_create_links()
  2. 5 og.module \og_og_create_links()
  3. 5.3 og.module \og_og_create_links()
  4. 5.7 og.module \og_og_create_links()
  5. 6.2 og.module \og_og_create_links()
  6. 6 og.module \og_og_create_links()

File

./og.module, line 2261

Code

function og_og_create_links($group) {
  $exempt = array_merge(variable_get('og_node_types', array(
    'og',
  )), variable_get('og_omitted', array()));
  foreach (node_get_types() as $type) {

    // we used to check for node_access(create) but then node admins would get a false positive and see node types that they could not create
    if (!in_array($type->type, $exempt) && module_invoke(node_get_types('module', $type), 'access', 'create', $type)) {
      $links[] = l(t('Create !type', array(
        '!type' => $type->name,
      )), "node/add/{$type->type}", array(
        'title' => t('Add a new !s in this group.', array(
          '!s' => $type->name,
        )),
      ), "gids[]={$group->nid}");
    }
  }
  return $links ? $links : array();
}