You are here

function homebox_og_override_group in Homebox 6.2

Same name and namespace in other branches
  1. 6.3 homebox_og/homebox_og.module \homebox_og_override_group()
  2. 7.2 homebox_og/homebox_og.module \homebox_og_override_group()

Override a group's homepage with a homebox

See also

homebox_og_menu_alter()

1 string reference to 'homebox_og_override_group'
homebox_og_menu_alter in homebox_og/homebox_og.module

File

homebox_og/homebox_og.module, line 58
Organic Groups integration for Homebox

Code

function homebox_og_override_group($node) {

  // Check if this is a group homepage
  if (og_is_group_type($node->type)) {

    // Fetch the designated homebox
    if ($name = variable_get('homebox_og_home', '')) {

      // Make sure the page exists
      if ($page = homebox_get_page($name)) {

        // Make sure the user has permission to view the homebox
        if (_homebox_user_access_view_homebox($page)) {

          // Force group name as title
          drupal_set_title($node->title);

          // Return the designated homebox
          return homebox_build($page);
        }
      }
    }
  }

  // Just return the regular node
  return node_page_view($node);
}