Posted by michelle on March 23, 2007 at 7:04pm
I've been searching through the forums looking for stuff to help me customize my forums. I've found some snippits and hacks and thought I'd gather the links here. Warning: Some of these hack core, which is really not recommended.
Add pager to top of page:
http://drupal.org/node/79352#comment-148773
http://drupal.org/node/79352#comment-223909
Replace text links with buttons:
http://drupal.org/node/56127#comment-111222
Change "add new comment" to "reply":
http://drupal.org/node/78562#comment-145094
Moving the forum header:
http://www.hiveminds.co.uk/node/913#comment-253
That's if for now... Will add more as I find them.
Michelle

Comments
Change comment links
We have a hook_link_alter nowadays that can be used to change the link. One could also change $node->links['comment_add']['title'] in node.tpl.php and then - instead of print $links - use print theme('links', $node->links, array('class' => 'links inline')).
This can be beautified by moving the code to template.php's variable hook.
Elaborate, please?
I tried to do the template.php route, but I don't think I know what I'm doing enough. There is this code there already (from flatforum):
So immediately before it I put:
I also tried doing
Neither of those had any effect. What should I be putting there?
Thanks,
Michelle
Links isn't the right
Links isn't the right variable here, because it is a holding a string (links in HTML) set in phptemplate_node (themes/engines/phptemplate.engine: 272):
<?php'links' => $node->links ? theme('links', $node->links, array('class' => 'links inline')) : '',
?>
What you need to modify is $node->links, then regenerate $links to hold the new info, which would go a bit like:
<?php
function _phptemplate_variables($hook, $vars) {
// rest of the _phptemplate_variables function
// Now, in $hook == 'node':
if (!empty($vars['node']->links) && !empty($vars['node']->links['comment_add'])) {
$vars['node']->links['comment_add']['title'] = t('Reply');
$variables['links'] = theme('links', $vars['node']->links, array('class' => 'links inline'));
}
?>
(standard syntax error disclaimer applies)
Works great
I just had to comment out the original flatforum line and it worked. Thanks!
Michelle
Not working
Does anyone know if this still work in 5.2/garland?
I get an error: syntax error, unexpected $end"
Perhaps there is something in your syntax error disclaimer that I don't know yet as a newcomer ... ;)
Typo
phptemplate.engine uses the variable name "$variables" but in the example, "$vars" is being used.
The correct syntax for the final line is:
$vars['links'] = theme('links', $vars['node']->links, array('class' => 'links inline'));
This is just a consistency thing... hope it helps.
Web Development in Nottingham, UK by Kineta Systems
Web Development in Nottingham, UK by Kineta Systems / Follow me on Twitter! @NikLP
Getting forum header to work in Drupal 5
Thanks for the listing. However, I don't quite get the forum header solution to work with Drupal 5. Any suggestions?