unlcms / UNL-CMS

Drupal 7 implementation at the University of Nebraska–Lincoln
http://unlcms.unl.edu/
GNU General Public License v2.0
4 stars 13 forks source link

og_context is not set on taxonomy pages #906

Closed ericras closed 8 years ago

ericras commented 8 years ago

strikeout: this was about Feeds in another issue ....... Any newer breaks Image Grabber

ericras commented 8 years ago
function unl_init() {
  // Set a Group Context on taxonomy term pages that have a "Groups audience" field attached.
  if (module_exists('og_context')) {
    $term_group = _group_context_handler_entity('taxonomy_term', NULL, 2);

    if (!empty($term_group)) {
      foreach($term_group as $entity_type => $entity_ref) {
        foreach($entity_ref as $key => $id) {
          og_context('node', node_load($id));
        }
      }
    }
  }
ericras commented 8 years ago

Tried it within the OG theme in the preprocess functions but it only causes the theme layer stuff (like site title) to change. It runs too late to get the OG Menu set properly. Thus I intend to stick it in the UNL module