I would like to edit the "latest posts" block in UIEforum. It works great but it displays too much information for my needs!

Right now the block displays this information
- forum name
- post title
- 'poster' user name
- date posted (long date)

I only need it to display
- post title
- date

Which file do I need to edit??

Thanks!

Comments

vm’s picture

in uieforum.module find these lines:

case 'view':
      if (user_access('access '.uieforum_get_module_security_name()))
      {
		
        $sidenumposts = variable_get('forum_block_num_'. $delta, $defaultuieforum_num);
        $SideThreads = uieforum_get_last_posts($sidenumposts);
        $sidecounter = 0;

        $SideThreadTable = "<ul class=\"uieforum_ul\">";

        if ($SideThreads != FALSE)
        {
          foreach ($SideThreads as $Thread)
          {
            $SideThreadTable .= "<li class=\"uieforum_leaf\"><span class=\"lw1\">";
            $SideThreadTable .= "<span class=\"block-forum-title\">".l(t($Thread->ForumName), uieforum_get_module_menu_name(), null, "fid=$Thread->ForumID")."</span>";
            $SideThreadTable .= get_thread_link_text($Thread);
            $SideThreadTable .= theme('username', user_load(array('uid' => $Thread->LastPoster)));
            $SideThreadTable .= "<div style=\"text-align: right; width: 100%\"><small>".get_thread_link_text_last_post($Thread, uieforum_parse_date($Thread->LastPost, "d M 'y - H:i")._uieforum_icon(null, null, null, 'newpost.gif'))."</small></div>\n";
            $SideThreadTable .= "</span></li>";
          }
        }

        $SideThreadTable .= "</ul>";

        $block_content = "<style type=\"text/css\" media=\"all\">@import \"modules/".uieforum_get_module_name()."/css/style.css\";</style>\n".$block_content;
        $block_content .= $SideThreadTable;


        // check to see if there was any content before setting up the block
        if ($block_content == '')
          return;

        // set up the block
        $block['subject'] = $UIEForumTitle;
        $block['content'] = $block_content;
        return $block;
      }
  }
} // end uieforum_block

you'll have to hack these , as I don't believe they provide the ability to over ride them in the theme.

specifically: this part of above code:

$SideThreadTable .= "<li class=\"uieforum_leaf\"><span class=\"lw1\">";
            $SideThreadTable .= "<span class=\"block-forum-title\">".l(t($Thread->ForumName), uieforum_get_module_menu_name(), null, "fid=$Thread->ForumID")."</span>";
            $SideThreadTable .= get_thread_link_text($Thread);
            $SideThreadTable .= theme('username', user_load(array('uid' => $Thread->LastPoster)));
            $SideThreadTable .= "<div style=\"text-align: right; width: 100%\"><small>".get_thread_link_text_last_post($Thread, uieforum_parse_date($Thread->LastPost, "d M 'y - H:i")._uieforum_icon(null, null, null, 'newpost.gif'))."</small></div>\n";
            $SideThreadTable .= "</span></li>";
erik_osaka’s picture

Wow, thanks for the quick reply! I'll try it out ASAP.

erik_osaka’s picture

took out a couple of lines and worked like a charm, thanks!

daniel.hunt’s picture

VeryMisunderstood: Very nice replying :)
The 5.0 port for this module is almost comlete (I'm delegating ;) ) - I'll look into theming for the various parts of the forum in future, it would make the module much more customisable indeed.

Nice one
Daniel

vigo-1’s picture

Delegating are you...? :-)

In that case I want a corner office and a large tub of Rocky Road ;-)

daniel.hunt’s picture

Uh oh...

*runs out of the room really really fast*

:D

vigo-1’s picture

BRUHAHAHAHHAHAHAHAHHAHAHAAH!

;-)

knight42’s picture

Hey People

Thought id tag on the end of this thread as am looking at the same piece of code trying to change it!!!

rather than just post the latest post title/user/date etc im actually looking to post the entire first thread of a forum topic, so the end results are like a blog with a full story (first post in a thread only) of each topic.

Im guessing I need to add a few lines in there, something that will print back the entire thing rather than just the thread title. Would anyone have any good ideas?

Thanks for the help in advance.

DK

btully’s picture

it would be great if the author could place the HTML output into a theme function that could be overriden via an external module or template.php. otherwise we're required to "hack" the uieforum code and it will get lost whenever an update is applied.

how about:


...
    case 'view':
      theme_uieforum_block_output();

...

theme_uieforum_block_output() {

      if (user_access('access '.uieforum_get_module_security_name())) {
        $sidenumposts = variable_get('forum_block_num_'. $delta, $defaultuieforum_num);
        $SideThreads = uieforum_get_last_posts($sidenumposts);
        $sidecounter = 0;

        $SideThreadTable = "<ul class=\"uieforum_ul\">";

        if ($SideThreads != FALSE) {
          foreach ($SideThreads as $Thread) {
            $SideThreadTable .= "<li class=\"uieforum_leaf\"><span class=\"lw1\">";
            $SideThreadTable .= "<span class=\"block-forum-title\">".l($Thread->ForumName, uieforum_get_module_menu_name(), null, "fid=$Thread->ForumID")."</span>";
            $SideThreadTable .= get_thread_link_text($Thread, false);
            $SideThreadTable .= theme('username', user_load(array('uid' => $Thread->LastPoster)));
            $SideThreadTable .= "<div style=\"text-align: right; width: 100%\"><small>".get_thread_link_text_last_post($Thread, uieforum_parse_date($Thread->LastPost, "d M 'y - H:i")._uieforum_icon(null, null, null, 'newpost.gif'))."</small></div>\n";
            $SideThreadTable .= "</span></li>";
          }
        }

        $SideThreadTable .= "</ul>";

        drupal_add_css(drupal_get_path('module', uieforum_get_module_name()) .'/css/style.css');
        $block_content .= $SideThreadTable;


        // check to see if there was any content before setting up the block
        if ($block_content == '') {
          return;
        }

        // set up the block
        $block['subject'] = $UIEForumTitle;
        $block['content'] = $block_content;
        return $block;


}