To make our forums at http://www.ubercart.org look more "forumish", I made a few changes and am happy to share if anyone is looking for similar results.

This post is about removing the forum topic navigation that is added to the bottom of the first post in any thread. It's just pretty messy and can't imagine how it would be useful like it is. I'm sure a better replacement could be dreamed up (where the links were at the bottom of the whole thread instead of inside the first post), but for now I've just removed it by modifying flatforum_nodeapi:

function flatforum_nodeapi($node, $op) {
  if (isset($node->content['forum_navigation'])) {
    unset($node->content['forum_navigation']);
  }
  _flatforum_act($op, is_object($node) ? $node->uid : $node['uid']);
}

Hope that helps someone else!

Comments

airblaster’s picture

I basically achieved the same by using

[...]
    case 'node':    
[...]
        $vars['content'] = $vars['node']->content['body']['#value'];
[...]

in template.php.

Don't know for sure if this has any side-effects, though.

rkn-dupe’s picture

What file is flatforum_nodeapi ?!

azote’s picture

hey rszrama, your way didn't work for me...

hey airblaster, if you do it that way you lose the Attachments on the post
you need to add this to your template.php inside the template folder:
to only remove that:

function phptemplate_forum_topic_navigation($node){
        return _phptemplate_callback('forum_topic_navigation', array('node' => $node));
}
rkn-dupe’s picture

Azote - thanks that worked for me, though it puts this line in:
<!-- PHPTemplate was instructed to override the forum_topic_navigation theme function, but no valid template file was found. -->
Not that it matters.

michelle’s picture

Thanks, azote. That's exactly what I was looking for. And thanks, rszrama for starting this. :)

Michelle

michelle’s picture

I just found a problem with azote's method. It interferes with pathauto's bulk update. Evidentally, pathauto uses that link to navigate the posts. To fix it (and get rid of that error method in general), just create an empty text file called forum_topic_navigation.tpl.php in your theme directory.

Michelle

rkn-dupe’s picture

Thanks michelle

halfiranian’s picture

Hi,

What do the [...]s in airblaster's first post correspond to? I'm assuming it means use parts of rszrama's first code? It would really help if we could have the complete version to copy and paste for us php rookies.

Cheers

michelle’s picture

That's referring to the rest of the function _phptemplate_variables in template.php. Don't worry about trying to use that method, though. By far the simplest method is to add this to template.php:

function phptemplate_forum_topic_navigation($node){
return ;
}

Michelle

samtemp07’s picture

None of those solutions work for v6.2.

Has anyone found a solution update?

michelle’s picture

Status: Active » Fixed

Yes, but it's not as easy because of the way the new preprocesses work. You need to stop the preprocess from running. It's in the advforum module code if you want to see how to do it.

No sense in leaving this open... flatforum is dead.

Michelle

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

doublejosh’s picture

Yups. This seems to work like a charm. (Just wanted to post the full function example.)

function MYTHEME_preprocess_node(&$vars) {
  // node type specific stuff...
  if($vars['nid']){
    switch($vars['type']) {
      case 'forum' :
        $vars['content']= $vars['node']->content['body']['#value']; // remove forum navigation
      break;
    } // end switch
  }
}
michelle’s picture

Not sure why you're posting on this ancient issue on a dead module but I should point out to any future searchers that stumble on it that doing it this way means the poor performing query is still run so you're getting that performance hit for nothing. It also assumes that you want nothing else but what's in the body and you'll lose any other things that have been added to $content.

Michelle

doublejosh’s picture

Cripes. Quite right!
Just always like to post simple cut and pastable code when I might help someone.

Didn't notice it was an issue queue, just a general approach for forum posts.

Would love to find the technique that would kill this query before it's performed and added to content.

michelle’s picture

You need to bypass the whole preprocess with a registry alter. AF does it if you want to see the code.

Michelle

doublejosh’s picture

Ah, perfect information.
I'm planning to add AF within three months, so I can afford the performance hit by hiding it in theme or CSS until then.