TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,021
  • Total Topics: 21,332
  • Online today: 496
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 249
  • Total: 249

Recent Topics and User Name

Started by RoarinRow, January 13, 2006, 10:55:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RoarinRow

How could you add the user's name as say the third line in the Recent Topics block?

Right now is shows:

Date of topic
Name of topic

I'd like to add the name of the member who posted that topic.

Thanks!

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

manuelap

I have exactly the same question! How to get the author in the recent topics block

iowamf

that's a great idea!

much more valuable use of a text than the precise second that the post was made.

can you tell i'm not a big fan of putting the time stamp on the recent topics block?  :)

WebMasterZ


manuelap

#4
I have  SMF 1.1 RC2 in combination with TinyPortals and in this version the TPBlock does not have an option to present users in the Recent topics TPblock... I am really just looking for making users visible in the Recent Topics block....

manuelap

This is the block I am referring to in the file TPortalBlocks.template.php:

// TPortal recent topics block
function TPortal_recentbox()
{
    global $context, $settings, $options, $txt , $modSettings;
    // is it a number?
    if(!is_numeric($context['TPortal']['recentboxnum']))
                     $context['TPortal']['recentboxnum']='10';

    // leave out the recycle board, if any
    if(isset($modSettings['recycle_board']))
      $bb=array($modSettings['recycle_board']);
    else
      $bb=array();
    $what=ssi_recentTopics($num_recent = $context['TPortal']['recentboxnum'], $bb, $output_method = 'array');

    // Output the topics
   $counter=1; $cmax=count($what);
    foreach($what as $w){
            echo '<div style="white-space: nowrap; overflow: hidden;" class="smalltext">
                        <a href="'.$w['href'].'">'.$w['short_subject'].'</a>

                     </div>
                     <div style="overflow: hidden;" class="smalltext">';
            if(!$w['new'])
               echo '<img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /> ';

         echo '['.$w['time'].']</div>';

           if($counter != $cmax)
              echo '
';
           $counter++;
    }
}




bloc

Datestamp is pretty important imho..but author is not so bad to have either of course... ;)

Luckily its not hard to add: open TPortalBlocks.template and find:
    // Output the topics
$counter=1; $cmax=count($what);
echo '<div style="width: 100%; overflow: hidden;">';
    foreach($what as $w){
            echo '<div style="white-space: nowrap;" class="smalltext">
            <a href="'.$w['href'].'">'.$w['short_subject'].'</a>
            </div>
            <div class="smalltext">';
            if(!$w['new'])
               echo '<a href="'.$w['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

echo '['.$w['time'].']</div>';


and replace with:
    // Output the topics
$counter=1; $cmax=count($what);
echo '<div style="width: 100%; overflow: hidden;">';
    foreach($what as $w){
            echo '<div style="white-space: nowrap;" class="smalltext">
            <a href="'.$w['href'].'">'.$w['short_subject'].'</a>
            </div>
            <div class="smalltext">', $txt[525], ' ', $w['poster']['link'], '</div>
            <div class="smalltext">';
            if(!$w['new'])
               echo '<a href="'.$w['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

echo '['.$w['time'].']</div>';


I will add this permanently for the next version. 

manuelap

Thank you very much for this fix. I had already found a work around through using block snippets, but this looks beautiful!

resurgence

#8
very nice! :) i love it. adding this to my test board.

edit:

is this the right code to make the username bold like the block here?


            <div class="smalltext">', $txt[525].' <b>', $w['poster']['link'], '</b>','</div>


right?

technodragon73

I used this fix and it works great...however, the default theme folder has a different code than what was applied here...

This website is proudly hosted on Crocweb Cloud Website Hosting.