og_forum_preprocess_node can insert wrong breadcrumbs by wrongly processing each node in og_ghp_ron view output

allenshaw - October 20, 2009 - 08:40
Project:OG Forum
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:paulbooker
Status:reviewed & tested by the community
Description

This function appears to run for every node returned by the og_ghp_ron view included on the group home page. As a result, it's rewriting the breadcrumb, repeatedly, for each item in the view.

Because of this, if the last item in the og_ghp_ron view is a forum post, the final state of the breadcrumb is what would be appropriate for that forum post, but not for the group home page.

My quick fix is to change this if() statement

  if ($variables['type'] == 'forum') {

to this
  if ($variables['nid'] == arg(1) && $variables['type'] == 'forum') {

May not be the most elegant fix; simply relies on the current nid to be at arg(1).

#1

dazweeja - October 23, 2009 - 05:04

I agree. Much better to check that $variables['page'] == TRUE or:

<?php
if (!empty($variables['page']) && $variables['type'] == 'forum') {
?>

#2

dazweeja - October 23, 2009 - 05:19

Patch attached.

AttachmentSize
609274.patch 403 bytes

#3

paulbooker - October 26, 2009 - 10:55
Assigned to:Anonymous» paulbooker
Status:active» reviewed & tested by the community

I'll get this committed to the development branch later today

 
 

Drupal is a registered trademark of Dries Buytaert.