Main Menu
collapse

Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

User Info

Welcome Guest.
Please log in.

Who's Online

  • Dot Guests: 940
  • Dot Hidden: 0
  • Dot Users: 1
  • Dot Users Online:

Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]


If you're interested in helping other members with support requests, consider joining the Community Support Helpers group.

Displaying Message Icons On Portal

Started by worm82075, March 03, 2010, 10:04:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

worm82075

While I wait patiently for support I thought I might trouble you good folks further for some custom coding.
I've been using SimplePortal since it's inception. Originally it displayed message icons instead of sp specific post and topic icons. I use approximately 20 different custom icons to elude to the nature of topics and the posts within. I really need my message icons back on the portal. If anyone can point me in the right direction it would be much appreciated.

AngelinaBelle

Allude?
Where are you talking about displaying message icons on the portal?
In the Articles that are displayed between the top and bottom blocks?
In a "Recent Posts/Topics" block? or in an "Articles" block?

Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

worm82075

Yes, allude. Sorry for my poor grammar.

I would like them to display in the recent posts and topics blocks.

AngelinaBelle

I think this can be adresssed in custom coding, in the same way that the articles block allows you to choose between category icon, poster avatar, or none.

This is actually not so difficult.
Do you know how to get started on this?
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

worm82075

Custom coding? As in custom PHP blocks? if so then no I haven't a clue. I'm pretty proficient at altering code under direction but writing it from scratch is a whole other ballgame.

If you are indeed referring to custom php blocks I could probably piece it together given time and research but that will have to wait as my site is currently without any admin controls for sp.

AngelinaBelle

OK.  I've recently done some custom coding in the Articles block, so this is fresh in my mind, so I think I can help. 

I'm pretty sure it is not that complicated.  I will get back to you after I check to make sure this is true!

I have other things going on today, but may have something for you to try tomorrow or Friday.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

AngelinaBelle

Here's what I found out:
It is possible to have the topic icon for a recent TOPICS block, just using the existing tools.

To do that, I made some changes in sp_recent, in PortalBlocks.
See if you like this:

function sp_recent($parameters, $id, $return_parameters = false)
{
global $context, $txt, $scripturl, $settings, $user_info, $color_profile;
$block_parameters = array(
  'boards' => 'boards',
  'limit' => 'int',
  'type' => 'select',
  'display' => 'select',
  //AngelinaBelle
  'image' => 'select'
);
if ($return_parameters)
{
//AngelinaBelle
  $txt['sp_param_sp_recent_image'] = "Image:";
  $txt['sp_param_sp_recent_image_options'] = 'Standard Post/Topic|Message Icon';
  $helptxt['sp_param_sp_recent_image']= 'Display the standard Post/Topic icon, or the message icon';
 
  return $block_parameters;
}
$image = empty($parameters['image']) ? 0 : (int)$parameters['image'];
$boards = !empty($parameters['boards']) ? explode('|', $parameters['boards']) : null;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$type = 'ssi_recent' . (empty($parameters['type']) ? 'Posts' : 'Topics');
$display = empty($parameters['display']) ? 'compact' : 'full';
//AngelinaBelle -- options for
if (!empty($boards))
{
  $temp_query_see_board = $user_info['query_see_board'];
  $user_info['query_see_board'] .= ' AND b.ID_BOARD IN (' . implode(', ', $boards) . ')';
}
$items = $type($limit, null, 'array');
if (!empty($temp_query_see_board))
  $user_info['query_see_board'] = $temp_query_see_board;
if (empty($items))
{
  echo '
        ', $txt['error_sp_no_posts_found'];
  return;
}
else
  $items[count($items) - 1]['is_last'] = true;
$colorids = array();
foreach ($items as $item)
  $colorids[] = $item['poster']['id'];
if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
  foreach ($items as $k => $p)
  {
   if (!empty($color_profile[$p['poster']['id']]['link']))
    $items[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];
  }
}
if ($display == 'compact')
{
  foreach ($items as $key => $item)
   echo '
        <a href="', $item['href'], '">', $item['subject'], '</a> <span class="smalltext">', $txt[525], ' ', $item['poster']['link'], $item['new'] ? '' : ' <a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '<br />[', $item['time'], ']</span><br />', empty($item['is_last']) ? '<hr />' : '';
}
elseif ($display == 'full')
{
  echo '
        <table class="sp_fullwidth">';
  foreach ($items as $item)
  {
   //AngelinaBelle -- choose which image to use
   $item_image = (($image==0 || $parameters['type']=0 ) ? (sp_embed_image(empty($parameters['type']) ? 'post' : 'topic')) : $item['icon'] );
   echo '
         <tr>
          <td class="sp_recent_icon sp_center">
           ', $item_image, '
          </td>
          <td class="sp_recent_subject">
           <a href="', $item['href'], '">', $item['subject'], '</a>
           ', $item['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '<br />[', $item['board']['link'], ']
          </td>
          <td class="sp_recent_info sp_right">
           ', $item['poster']['link'], '<br />', $item['time'], '
          </td>
         </tr>';
  }
  echo '
        </table>';
}
}


If you need this also for recent POSTS, then the work also requires a change to SSI.php.  I am not so experienced and bold with SMF to feel confident changing things that might be called by lots of other things, so I am a little hesitant to do it. I could do it. It would be easy...

Remember, please, to save a copy of your current version of PortalBlocks.php.
Then replace the function sp_recent with the one I just made. If you don't like it, you can always switch back.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Chen Zhen

#7
Quote from: AngelinaBelle on March 03, 2010, 08:20:15 PM
If you need this also for recent POSTS, then the work also requires a change to SSI.php.  I am not so experienced and bold with SMF to feel confident changing things that might be called by lots of other things, so I am a little hesitant to do it. I could do it. It would be easy...

Remember, please, to save a copy of your current version of PortalBlocks.php.
Then replace the function sp_recent with the one I just made. If you don't like it, you can always switch back.

IMAO - When you need to use a function but want to change it, just copy the whole sub-routine into a block.
Change the name of the function and make your edits.

To execute it, simply call it.
Sometimes a few variables need to be predefined before calling a function, but not in all cases.

ie. for the above code try this:

/*  Recent messages block with topic icons (if your theme uses them) */
/* For SMF 1.1.1x and Simple Portal 2.3.1 */

sp_recent_2($parameters, $id, $return_parameters = false);

function sp_recent_2($parameters, $id, $return_parameters = false)
{
global $context, $txt, $scripturl, $settings, $user_info, $color_profile;
$block_parameters = array(
  'boards' => 'boards',
  'limit' => 'int',
  'type' => 'select',
  'display' => 'select',
  'image' => 'select',
);
if ($return_parameters)
{
/* AngelinaBelle */
  $txt['sp_param_sp_recent_image'] = 'Image:';
  $txt['sp_param_sp_recent_image_options'] = 'Standard Post/Topic|Message Icon';
  $helptxt['sp_param_sp_recent_image'] = 'Display the standard Post/Topic icon, or the message icon';

  return $block_parameters;
}
$image = empty($parameters['image']) ? 0 : (int)$parameters['image'];
$boards = !empty($parameters['boards']) ? explode('|', $parameters['boards']) : null;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$type = 'ssi_recent' . (empty($parameters['type']) ? 'Posts' : 'Topics');
$display = empty($parameters['display']) ? 'compact' : 'full';
/* AngelinaBelle -- options for */
if (!empty($boards))
{
  $temp_query_see_board = $user_info['query_see_board'];
  $user_info['query_see_board'] .= ' AND b.ID_BOARD IN (' . implode(', ', $boards) . ')';
}
$items = $type($limit, null, 'array');
if (!empty($temp_query_see_board))
  $user_info['query_see_board'] = $temp_query_see_board;
if (empty($items))
{
  echo '
        ', $txt['error_sp_no_posts_found'];
  return;
}
else
  $items[count($items) - 1]['is_last'] = true;
$colorids = array();
foreach ($items as $item)
  $colorids[] = $item['poster']['id'];
if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
  foreach ($items as $k => $p)
  {
   if (!empty($color_profile[$p['poster']['id']]['link']))
    $items[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];
  }
}
if ($display == 'compact')
{
  foreach ($items as $key => $item)
   echo '
        <a href="', $item['href'], '">', $item['subject'], '</a> <span class="smalltext">', $txt[525], ' ', $item['poster']['link'], $item['new'] ? '' : ' <a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '<br />[', $item['time'], ']</span><br />', empty($item['is_last']) ? '<hr />' : '';
}
elseif ($display == 'full')
{
  echo '
        <table class="sp_fullwidth">';
  foreach ($items as $item)
  {
   /* AngelinaBelle -- choose which image to use */
   $item_image = (($image==0 || $parameters['type']=0 ) ? (sp_embed_image(empty($parameters['type']) ? 'post' : 'topic')) : $item['icon'] );
   echo '
         <tr>
          <td class="sp_recent_icon sp_center">
           ', $item_image, '
          </td>
          <td class="sp_recent_subject">
           <a href="', $item['href'], '">', $item['subject'], '</a>
           ', $item['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '<br />[', $item['board']['link'], ']
          </td>
          <td class="sp_recent_info sp_right">
           ', $item['poster']['link'], '<br />', $item['time'], '
          </td>
         </tr>';
  }
  echo '
        </table>';
}
}


worm82075:

If I understand you correctly, your custom theme has topic icons and this I assume will display them.
Currently for testing I do not have a theme that has topic icons installed on any of my SMF 1.1.1x versions, therefore I was not able to test this fully as of yet. (I tested it but all my current themes only display text for thread headers)

What theme are you using worm82075?  If I install the same theme on one of my SMF 1.1.1x test forums I can test this fully.

UD

AngelinaBelle

Quote from: Underdog on March 06, 2010, 12:14:24 AM
IMAO - When you need to use a function but want to change it, just copy the whole sub-routine into a block.
Change the name of the function and make your edits.

To execute it, simply call it.
Yeah -- good point. A renamed SSI function replacement won't interfere with anything calling the SSI function. Especially if I don't even put it in SSI.

I'm just awfully timid.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

worm82075

All of my themes are based off of my default so that each theme need only have it's own images and an index.template.php.

Are we talking about the same icons?  I'm talking about the smf message icons. You know;, , , , etc...etc....

See the pic attached. I'd like to see my custom icons back on the portal like they were originally at SP's inception.

Chen Zhen

#10
Quote from: worm82075 on March 06, 2010, 08:25:20 PM
All of my themes are based off of my default so that each theme need only have it's own images and an index.template.php.

Are we talking about the same icons?  I'm talking about the smf message icons. You know;, , , , etc...etc....

See the pic attached. I'd like to see my custom icons back on the portal like they were originally at SP's inception.

Some themes have icons for each board (graphic pics or graphic text - whatever).. I am going to check out your forum and run a test site with the same SMF version and theme. I see it is the topic icons you want displayed.

Angelina - When copying a whole function, renaming it and using it in the block there is nothing to be timid about since no existing files are being tampered with.   ;)
 

UD

AngelinaBelle

Underdog,
It never even occured to me that putting a renamed block function in a block would even work. Some parts of SimplePortal, I haven't traced through yet.

If you are running with this, I'll leave it.

worm82075
Looks like Underdog is running with the ball, now.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Chen Zhen

#12
Quote from: AngelinaBelle on March 07, 2010, 08:04:49 AM
Underdog,
It never even occured to me that putting a renamed block function in a block would even work. Some parts of SimplePortal, I haven't traced through yet.

If you are running with this, I'll leave it.

worm82075
Looks like Underdog is running with the ball, now.

Gee thanks.   :0  lol.

I was just pointing out how you can copy functions and change/use them without having to edit any php files.

I will finish this up later this week when I have more time.

UD




AngelinaBelle

Oh! when you said you were testing it out on your own test forum, I figured you had written some code. Since you seem to be more experienced than me, I figured that was a good thing. I'm still around.  Just shout.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Chen Zhen

#14
Try this...


/*  Recent Posts block for SMF 1.1.1x  */

global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER, $user_info, $modSettings, $func, $boardurl;

/* Adjustable variables */
$paramters = array();
$numPosts = 10;
$exclude_boards = null;
$format = 'vertical';
$msg_new = '[new]';
$postby = 'Posted By:';
$intro_statement = '';
$end_statement = '';
$showColor = true;   
$default_icon = 'xx';
$numPosts = (int) $numPosts;

/*  Main code  */   
   
   // Pass all the parematers
   foreach($paramters as $myparam)
   {
      if ($myparam['parameter_name'] == 'format')
         $format =  $myparam['data'];
      if ($myparam['parameter_name'] == 'numPosts')
         $numPosts = (int) $myparam['data'];
      if ($myparam['parameter_name'] == 'showcolor')
      {
         if ($myparam['data'] == 'true')
            $showColor = true;
         else
            $showColor = false;
      }
   
   }
/* Intro Statement */   
   echo $intro_statement;

   if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
      $exclude_boards = array($modSettings['recycle_board']);
   else
      $exclude_boards = empty($exclude_boards) ? array() : $exclude_boards;

   /*  Query all the posts  */
   $request = db_query("
      SELECT
         m.posterTime, m.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, icon, m.ID_BOARD, b.name AS bName, mg.onlineColor, mg.ID_GROUP,
         IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
         IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
         IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled
      FROM ({$db_prefix}messages AS m, {$db_prefix}boards AS b)
         LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
          LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
         
         " . (!$user_info['is_guest'] ? "
         LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = m.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
         LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = m.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
      WHERE m.ID_MSG >= " . ($modSettings['maxMsgID'] - 25 * min($numPosts, 5)) . "
         AND b.ID_BOARD = m.ID_BOARD" . (empty($exclude_boards) ? '' : "
         AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
         AND $user_info[query_see_board]
      ORDER BY m.ID_MSG DESC
      LIMIT $numPosts", __FILE__, __LINE__);
   $posts = array();
   while ($row = mysql_fetch_assoc($request))
   {
if ($row['icon'] == false)
{$row['icon'] = $default_icon;}
      $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '
')));
      if ($func['strlen']($row['body']) > 128)
         $row['body'] = $func['substr']($row['body'], 0, 128) . '...';

      /*  Censor the post info  */
      censorText($row['subject']);
      censorText($row['body']);
      /*  Feed the array with the info from the db  */
      $posts[] = array(
         'board' => array(
            'id' => $row['ID_BOARD'],
            'name' => $row['bName'],
            'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
            'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'
         ),
         'topic' => $row['ID_TOPIC'],
                        'icon' => '<img src="' . $boardurl.'/Themes/default/images/post/'.$row['icon'].'.gif" alt="~" title="'.$row['subject'].'" border="0" />',
         'poster' => array(
            'id' => $row['ID_MEMBER'],
            'name' => $row['posterName'],
            'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
            'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>',
            'colorlink'  => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"><font color="' . $row['onlineColor'] . '">' . $row['posterName'] . '</font></a>',
         ),
         'subject' => $row['subject'],
         'short_subject' => shorten_subject($row['subject'], 25),
         'preview' => $row['body'],
         'time' => timeformat($row['posterTime']),
         'timestamp' => forum_time(true, $row['posterTime']),
         'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new',
         'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'] . '">' . $row['subject'] . '</a>',
         'new' => !empty($row['isRead']),
         'new_from' => $row['new_from'],
      );
   }
   mysql_free_result($request);
   
   
   if  (empty($posts))
      return;

   echo '
      <table border="0">';
   
   if ($format == 'vertical')
   {
      foreach ($posts as $post)
      {
         
         echo '
            <tr>
               <td valign="top">
                 
                  '.$post['icon'].'</td><td valign="top"><span class="smalltext"><a href="', $post['href'], '"><b>', $post['subject'], '</b></a>
                  ', $postby, ' ', ($showColor == true ? $post['poster']['colorlink'] : $post['poster']['link']), '
                  ', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $msg_new . '" border="0" /></a>', '
                  <br />', $post['time'], '
                  </span>
                  <hr />
               </td>
         
            </tr>';
      }
   }
   else
   {
      foreach ($posts as $post)
         echo '
            <tr>
               <td align="right" valign="top">
                  [', $post['board']['link'], ']
               </td>
               <td valign="top">
                  <a href="', $post['href'], '">', $post['subject'], '</a>
                  ', $postby, ' ', ($showColor == true ? $post['poster']['colorlink'] : $post['poster']['link']), '
                  ', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $msg_new . '" border="0" /></a>', '
               </td>
               <td align="right" nowrap="nowrap">
                  ', $post['time'], '
               </td>
            </tr>';
   }
   echo '
      </table>';
   
   
   
/* Ending Statement */
   echo $end_statement;



You can make some specific adjustments from the top of the block.

UD

Chen Zhen


Worm -
Does this block work the way you want?

If so.. mark the thread solved.


UD

worm82075

Yes it does work well but I would also like the same functionality for recent topics. Perhaps another variable that defines posts or topics. Thanks by the way.

Chen Zhen

#17
Recent Topics and Posts Block for SMF 1.1.1x

Adjustments can be set in the top of the block.

Imao - Set up the block with No Title from the style options at the bottom while editing the block.

PHP Portal Block:

/*  START - SMF 1.1.1x Recent Topics and Posts Block  */


/*             Adjustable variables        */
/* Set $numPosts or $numTopics to 0 to disable */
$paramters = array();
$numPosts = 10;
$numTopics = 10;
$exclude_boards_topics = null;
$exclude_boards_posts = null;
$format = 'vertical';
$msg_new = '[new]';
$postby = 'Posted By:';
$showColor = true;   
$default_icon = 'xx';

/* Get globals and set (int) for max */

global $context, $settings, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $modSettings, $func, $boardurl;
$numPosts = (int) $numPosts;
$numTopics = (int) $numTopics;

/*  These are for the images used in the titles below */
$posts_icon = $boardurl.'/Themes/default/images/post/xx.gif';
$topics_icon = $boardurl.'/Themes/default/images/topic/normal_post.gif';

/* These are the titles and/or ending statements */
$intro_posts = '<div class="smalltext" style="text-align: center; color: #216095;"><img src="'.$posts_icon.'" alt="" title="Recent Posts" width="16" height="16" /><strong>Recent Posts</strong></div><hr />';
$ending_posts = '<br />';
$intro_topics = '<div class="smalltext" style="text-align: center; color: #216095;"><img src="'.$topics_icon.'" alt="" title="Recent Topics" width="16" height="16" /><strong>Recent Topics</strong></div><hr />';
$ending_topics = '<br />';

/*  START - Recent Posts  */     
if ($numPosts > 0)
{   
   foreach($paramters as $myparam)
   {
      if ($myparam['parameter_name'] == 'format')
         $format =  $myparam['data'];
      if ($myparam['parameter_name'] == 'numPosts')
         $numPosts = (int) $myparam['data'];
      if ($myparam['parameter_name'] == 'showcolor')
      {
         if ($myparam['data'] == 'true')
            $showColor = true;
         else
            $showColor = false;
      }
   
   }
/* Intro Statement */   
   echo $intro_posts;

   if ($exclude_boards_posts === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
      $exclude_boards_posts = array($modSettings['recycle_board']);
   else
      $exclude_boards_posts = empty($exclude_boards_posts) ? array() : $exclude_boards_posts;
   
   $request = db_query("
      SELECT
         m.posterTime, m.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, icon, m.ID_BOARD, b.name AS bName, mg.onlineColor, mg.ID_GROUP,
         IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
         IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
         IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled
      FROM ({$db_prefix}messages AS m, {$db_prefix}boards AS b)
         LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
          LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
         
         " . (!$user_info['is_guest'] ? "
         LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = m.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
         LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = m.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
      WHERE m.ID_MSG >= " . ($modSettings['maxMsgID'] - 25 * min($numPosts, 5)) . "
         AND b.ID_BOARD = m.ID_BOARD" . (empty($exclude_boards_posts) ? '' : "
         AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards_posts) . ")") . "
         AND $user_info[query_see_board]
      ORDER BY m.ID_MSG DESC
      LIMIT $numPosts", __FILE__, __LINE__);
   $posts = array();
   while ($row = mysql_fetch_assoc($request))
   {
if ($row['icon'] == false)
{$row['icon'] = $default_icon;}
      $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '
')));
      if ($func['strlen']($row['body']) > 128)
         $row['body'] = $func['substr']($row['body'], 0, 128) . '...';

      /*  Censor post subject  */
      censorText($row['subject']);
      censorText($row['body']);
     
      $posts[] = array(
         'board' => array(
            'id' => $row['ID_BOARD'],
            'name' => $row['bName'],
            'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
            'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'
         ),
         'topic' => $row['ID_TOPIC'],
                        'icon' => '<img src="' . $boardurl.'/Themes/default/images/post/'.$row['icon'].'.gif" alt="~" title="'.$row['subject'].'" border="0" />',
         'poster' => array(
            'id' => $row['ID_MEMBER'],
            'name' => $row['posterName'],
            'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
            'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>',
            'colorlink'  => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"><font color="' . $row['onlineColor'] . '">' . $row['posterName'] . '</font></a>',
         ),
         'subject' => $row['subject'],
         'short_subject' => shorten_subject($row['subject'], 25),
         'preview' => $row['body'],
         'time' => timeformat($row['posterTime']),
         'timestamp' => forum_time(true, $row['posterTime']),
         'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new',
         'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'] . '">' . $row['subject'] . '</a>',
         'new' => !empty($row['isRead']),
         'new_from' => $row['new_from'],
      );
   }
   mysql_free_result($request);
   
   
   if  (empty($posts))
      return;

   echo '
      <table border="0">';
   
   if ($format == 'vertical')
   {
      foreach ($posts as $post)
      {
         
         echo '
            <tr>
               <td valign="top">
                 
                  '.$post['icon'].'</td><td valign="top"><span class="smalltext"><a href="', $post['href'], '"><b>', $post['subject'], '</b></a>
                  ', $postby, ' ', ($showColor == true ? $post['poster']['colorlink'] : $post['poster']['link']), '
                  ', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $msg_new . '" border="0" /></a>', '
                  <br />', $post['time'], '
                  </span>
                  <hr />
               </td>
         
            </tr>';
      }
   }
   else
   {
      foreach ($posts as $post)
         echo '
            <tr>
               <td align="right" valign="top">
                  [', $post['board']['link'], ']
               </td>
               <td valign="top">
                  <a href="', $post['href'], '">', $post['subject'], '</a>
                  ', $postby, ' ', ($showColor == true ? $post['poster']['colorlink'] : $post['poster']['link']), '
                  ', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $msg_new . '" border="0" /></a>', '
               </td>
               <td align="right" nowrap="nowrap">
                  ', $post['time'], '
               </td>
            </tr>';
   }
   echo '
      </table>';   
   
/* Ending Statement */
   echo $ending_posts;
}
/*  END - Recent Posts  */

/*  START - Recent Topics  */   
if ($numTopics > 0)
{   
   foreach($paramters as $myparam)
   {
      if ($myparam['parameter_name'] == 'format')
         $format =  $myparam['data'];
      if ($myparam['parameter_name'] == 'numTopics')
         $numTopics = (int) $myparam['data'];
      if ($myparam['parameter_name'] == 'showcolor')
      {
         if ($myparam['data'] == 'true')
            $showColor = true;
         else
            $showColor = false;
      }
     
   }
   
   echo $intro_topics;


   if ($exclude_boards_topics === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
      $exclude_boards_topics = array($modSettings['recycle_board']);
   else
      $exclude_boards_topics = empty($exclude_boards_topics) ? array() : $exclude_boards_topics;

   $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
   $icon_sources = array();
   foreach ($stable_icons as $icon)
      $icon_sources[$icon] = 'images_url';
   
   $request = db_query("
      SELECT
         m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName, mg.onlineColor, mg.ID_GROUP,
         IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
         IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
         IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon
      FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
         LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
         LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
         " . (!$user_info['is_guest'] ? "
         LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
         LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
      WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($numTopics, 5)) . "
         AND t.ID_LAST_MSG = m.ID_MSG
         AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards_topics) ? '' : "
         AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards_topics) . ")") . "
         AND $user_info[query_see_board]
         AND ms.ID_MSG = t.ID_FIRST_MSG
      ORDER BY t.ID_LAST_MSG DESC
      LIMIT $numTopics", __FILE__, __LINE__);
   $posts = array();
   while ($row = mysql_fetch_assoc($request))
   {
if ($row['icon'] == false)
{$row['icon'] = $default_icon;}
      $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '
')));
      if ($func['strlen']($row['body']) > 128)
         $row['body'] = $func['substr']($row['body'], 0, 128) . '...';

      /* Censor the subject */
      censorText($row['subject']);
      censorText($row['body']);

      if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
         $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';
     
      $posts[] = array(
         'board' => array(
            'id' => $row['ID_BOARD'],
            'name' => $row['bName'],
            'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
            'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'
         ),
         'topic' => $row['ID_TOPIC'],
         'poster' => array(
            'id' => $row['ID_MEMBER'],
            'name' => $row['posterName'],
            'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
            'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>',
            'colorlink'  => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"><font color="' . $row['onlineColor'] . '">' . $row['posterName'] . '</font></a>',
         ),
         'subject' => $row['subject'],
         'short_subject' => shorten_subject($row['subject'], 25),
         'preview' => $row['body'],
         'time' => timeformat($row['posterTime']),
         'timestamp' => forum_time(true, $row['posterTime']),
         'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new',
         'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#new">' . $row['subject'] . '</a>',
         'new' => !empty($row['isRead']),
         'new_from' => $row['new_from'],
         'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="~" title ="'.$row['subject'].'" border="0" />',
      );
   }
   mysql_free_result($request);
   
   if  (empty($posts))
      return;

   echo '
      <table border="0">';
   
   if ($format == 'vertical')
   {
      foreach ($posts as $post)
      {     
         echo '
            <tr>
               <td valign="top">
                 
                  '.$post['icon'].'</td><td valign="top"><span class="smalltext"><a href="', $post['href'], '"><b>', $post['subject'], '</b></a>
                  ', $postby, ' ', ($showColor == true ? $post['poster']['colorlink'] : $post['poster']['link']), '
                  ', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $msg_new . '" border="0" /></a>', '
                  <br />', $post['time'], '
                  </span>
                  <hr />
               </td>
         
            </tr>';
      }
   }
   else
   {
      foreach ($posts as $post)
         echo '
            <tr>
               <td align="right" valign="top">
                  [', $post['board']['link'], ']
               </td>
               <td valign="top">
                  <a href="', $post['href'], '">', $post['subject'], '</a>
                  ', $postby, ' ', ($showColor == true ? $post['poster']['colorlink'] : $post['poster']['link']), '
                  ', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $msg_new . '" border="0" /></a>', '
               </td>
               <td align="right" nowrap="nowrap">
                  ', $post['time'], '
               </td>
            </tr>';
   }
   echo '
      </table>';   
   
   echo $ending_topics;
}
/*  END - Recent Topics  */

/*  END - SMF 1.1.1x Recent Topics and Posts Block  */


<<<<<<<<<<>>>>>>>>>>

If you want the Topics to also display the most recent posts icon in that topic...

In the above code, Find:

IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon


Replace with:

IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, ms.icon



UD

MultiformeIngegno

A chance of having this for rc3....? :)