I've implemented a 'jump to forum' drop down list, much like what is described here: http://drupal.org/node/91924

Just add the code to your forum-display.tpl.php file. It would be great if something like this is added to a future version. Currently this code doesn't filter the drop down list based on anon/user, or if any forums are private (can't remember if this is even an option).

Also, the code will add any containers as a selectable option, looking something like this:

Jump to:
--forum
--forum
--container
--forum

You have to hack the code to filter out building an entry for each container, like this:
if ($term->tid == 106) { continue; } // skip container
Just add the code right after the while ($term = db_fetch_object($vocabulary)) { statement.

Brad

Comments

Michelle’s picture

Thanks for the tip. This is actually something I wanted to add.

Michelle

Michelle’s picture

Listed on master to do list.

Michelle

Michelle’s picture

Title: forum drop-down list » Add jump to forum dropdown
Version: 5.x-1.x-dev » 6.x-1.x-dev
Assigned: Unassigned » Michelle
Category: feature » task
Michelle’s picture

Status: Active » Postponed

Will revisit this in 2.x.

Michelle

Michelle’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Assigned: Michelle » Unassigned
Category: task » feature
Status: Postponed » Active
Michelle’s picture

Just a note that this will be added as soon as the jump menu code is added to CTools.

Michelle

Michelle’s picture

Status: Active » Postponed

Postponing until after 2.0.

Michelle’s picture

Status: Postponed » Active

Setting active. This isn't a difficult one and will likely get into 2.x.

Michelle

troky’s picture

This one will create (ctools) drop down menu for D7... probably will work on D6, too with minor changes.

advanced_forum.module:

/**
 * Create a drop down list of forum hierarchy
 */
function advanced_forum_forum_jump($tid=0) {
  global $user;
  ctools_include('jump-menu');
  $select = array();
  $options = array();
  $vid = variable_get('forum_nav_vocabulary', 0);
  if ($tid > 0) {
    $forum_tree = taxonomy_get_tree($vid);
    foreach ($forum_tree as $forum) {
      $select[url("forum/" . $forum->tid)] = str_repeat("-", $forum->depth) . $forum->name;
    }
  }
  else {
    // nothing
  }

  $options['choose'] = t("- Select a forum -");

  // Create and return the jump menu.
  $form = drupal_get_form('ctools_jump_menu', $select, $options);
  return drupal_render($form);
}

theme.inc:

function advanced_forum_preprocess_views_view__advanced_forum_topic_list(&$variables) {
...
    $variables['forum_tools'] = advanced_forum_forum_tools($tid);
    $variables['forum_jump'] = advanced_forum_forum_jump($tid);
...
}

advanced-forum.naked.topic-list-outer-view.tpl

<?php if (!empty($forum_tools)): ?>
  <div class="forum-jump"><?php print $forum_jump; ?></div>
<?php endif; ?>
Michelle’s picture

I was going to make a view for this... Your way likely performs better but a view is more customizable by the end user. Dunno which is better for this... Just throwing that out there for now.

Michelle

Michelle’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Active » Postponed

This one slipped through the cracks. Moving this to D7 and postponing until there is a 3.x branch open for new features.

Ingumsky’s picture

Status: Postponed » Active

Any chance for this jump to forum menu to be added to 6.x-2.x Michelle?
I'm planning to review this code and create a patch for the latest dev.

Michelle’s picture

That's up to mcdruid. I help out in the queue but I haven't committed in a long time and am not likely to have any time to do so in the foreseeable future.

Ingumsky’s picture

OK. Thank you for the instant response.

Ingumsky’s picture

I've tested jump to forum code provided by @troky, changed it a bit and it works like a charm for 6.x-2.x now.
Here's the the code that works for me:
advanced_forum.module

/**
 * Create a drop down list of forum hierarchy
 */
function advanced_forum_forum_jump($tid=0) {
  global $user;
  $select = array();
  $options = array();
  $vid = variable_get('forum_nav_vocabulary', 0);
  if ($tid > 0) {
    $forum_tree = taxonomy_get_tree($vid);
    foreach ($forum_tree as $forum) {
      $select[url("forum/" . $forum->tid)] = str_repeat("•", $forum->depth) ." ". $forum->name;
    }
  }
  else {
    // nothing
  }

  $options['choose'] = t("- Select a forum -");

  // Create and return the jump menu.
  ctools_include('jump-menu');
  return drupal_get_form('ctools_jump_menu', $select, $options);
}

theme.inc

function advanced_forum_preprocess_views_view__advanced_forum_topic_list(&$variables) {
...
    $variables['forum_tools'] = advanced_forum_forum_tools($tid);
    $variables['forum_jump'] = advanced_forum_forum_jump($tid);
...
}

advanced-forum.naked.topic-list-outer-view.tpl

<?php if (!empty($forum_jump)): ?>
  <div class="forum-jump"><?php print $forum_jump; ?></div>
<?php endif; ?>

I can make a patch for this but with one of my patches still pending I need to know should I make this one over a clean 6.x-2.x-dev install or not.

Michelle’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev

I hate to make you go thru all the work of setting up a separate install for this patch. Just hang on for a bit. If mcdruid doesn't get to it first, I will try and see if I can take care of these before Drupalcon. My trouble is I don't have anything set up for working on AF right now since all my coding time goes to Artesian. So it's not a 2 minute commit for me like it would be if I was actively working on AF.

Ingumsky’s picture

OK. I understand. Thank you Michelle.

MasterChief’s picture

Subscribe :)

Michelle’s picture

@MasterChief: There is a follow button at the top of the issue you can use for that.

MasterChief’s picture

Thanks Michelle, i didn't see it !

troky’s picture

#9 committed to 7.x-2.x-dev

MasterChief’s picture

@Ingumsky i tried your patch in #15, it works very well, but just one thing to modify.

You need to replace this

$select[url("forum/" . $forum->tid)] = str_repeat("•", $forum->depth) ." ". $forum->name;

by :

$select[url("forum/" . $forum->tid)] = str_repeat("-", $forum->depth) ." ". $forum->name;

The special char make the forum name dissapear in my case :(