Welcome to Geeklog, Anonymous Friday, April 18 2025 @ 12:21 am EDT

Geeklog Forums

Forum hack to display in What's New


Status: offline

idonthack

Forum User
Newbie
Registered: 09/11/05
Posts: 14
I don't like the forum plugin's seperate forumposts block, and I don't like having it in the center of the page. I thought showing up in "What's New" would be perfect for it, since effectively that's what it's showing. This is a pretty quick-n-dirty kludge to do that, but its output looks nice and it is, of course, quick to implement.

Fixing it to show in What's New is very easy. You need to go to {your_geeklog_path}/plugins/forum/ and open up functions.inc

At the end of the file, insert this code:
Text Formatted Code

function plugin_whatsnewsupported_forum()
{
        return array('FORUM POSTS','last 5 posts');
}


 

If you want its section to say something different, it's pretty obvious what to modify.

Next, find the function called "phpblock_fourm_newposts", and copy that to a function called "plugin_getwhatsnew_forum". Inside plugin_getwhatsnew_forum, there will be some code that looks like this:
Text Formatted Code

$block_header = new Template($_CONF['path_layout'] . 'forum/layout');
$block_header->set_file (array ('block_header'=>'block_header.thtml'));
$block_header->set_var ('phpself', $PHP_SELF);
$block_header->set_var ('layout_url', $_CONF['layout_url']);
$block_header->set_var ('LANG_ORDERBY', $LANG_GF01['ORDERBY']);
$block_header->set_var ('LANG_NEW', $LANG_GF01['NEW']);
$block_header->set_var ('LANG_VIEWS', $LANG_GF01['VIEWS']);
$block_header->set_var ('LANG_POSTS', $LANG_GF01['POSTS']);
$block_header->set_var ('view_modemsg', $view_modemsg);
$block_header->parse ('output', 'block_header');
$retval = $block_header->finish($block_header->get_var('output'));


 


We're going to modify this to remove the lines that say things like "Last 5 Posts" because that will be handled by a different function.

Text Formatted Code

$block_header = new Template($_CONF['path_layout'] . 'forum/layout');
$block_header->set_file (array ('block_header'=>'block_header.thtml'));
$block_header->set_var ('phpself', '');
$block_header->set_var ('layout_url', $_CONF['layout_url']);
$block_header->set_var ('LANG_ORDERBY', '');
$block_header->set_var ('LANG_NEW', '');
$block_header->set_var ('LANG_VIEWS', '');
$block_header->set_var ('LANG_POSTS', '');
$block_header->set_var ('view_modemsg', '');
$block_header->parse ('output', 'block_header');
$retval = $block_header->finish($block_header->get_var('output'));


 


Note that this removes the links to sort by time, views, and posts. I removed them because I personally wouldn't use them, and when they're clicked there will be no way to change the display of "last 5 posts" in plugin_whatsnewsupported_forum. If you want to keep those, don't modify the lines that say phpself, ORDERBY, NEW, VIEWS, or POSTS.

Once you're finished and uploaded, it will display a section called "FORUM POSTS" in your "What's New" block.
 Quote

All times are EDT. The time is now 12:21 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content