[Bb-trac] [bbPress] #751: view_name always returns same name if called after bb_get_views

bbPress bb-trac at lists.bbpress.org
Tue Oct 9 17:21:36 GMT 2007


#751: view_name always returns same name if called after bb_get_views
-----------------------+----------------------------------------------------
 Reporter:  baptiste   |       Owner:     
     Type:  defect     |      Status:  new
 Priority:  low        |   Milestone:     
Component:  Front-end  |     Version:     
 Severity:  minor      |    Keywords:     
-----------------------+----------------------------------------------------
 Most themes list views with this code

 {{{
 <?php foreach ( bb_get_views() as $view => $title ) : ?>
 <li class="view"><a href="<?php view_link(); ?>"><?php view_name();
 ?></a></li>
 <?php endforeach; ?>
 }}}

 Most themes also call this code near the bottom of the page.

 However, in a theme where you have a sidebar (say on the left) that is
 called first, this code will cause view_name to always return the title of
 the last view in the view list, NOT the current view title.

 The problem is $view seems to be in the global context, so the theme is
 clobbering the 'current' $view that should be set.

 The easy fix was to change $view in that theme code (taken from kakumei,
 but used in most themes) to something like $tmpview. Then the titles
 display properly in view.php

-- 
Ticket URL: <http://trac.bbpress.org/ticket/751>
bbPress <http://bbpress.org/>
Innovative forum development


More information about the Bb-trac mailing list