You are here

function og_og_create_links in Organic groups 5.3

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.2 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 2415

Code

function og_og_create_links($group) {
  $post_types = og_get_types('group_post');
  $types = node_get_types();
  foreach ($post_types as $post_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.
    // When this becomes a proper menu in D6, we get sorting for free
    $type_name = $types[$post_type]->name;
    if (module_invoke($types[$post_type]->module, 'access', 'create', $post_type)) {
      $links["create_{$post_type}"] = l(t('Create !type', array(
        '!type' => $type_name,
      )), "node/add/{$post_type}", array(
        'title' => t('Add a new !s in this group.', array(
          '!s' => $type_name,
        )),
      ), "gids[]={$group->nid}");
    }
  }
  return $links ? $links : array();
}