TinyPortal

Development => Support => Topic started by: RoarinRow on January 13, 2006, 10:55:53 PM

Title: Recent Topics and User Name
Post by: RoarinRow on January 13, 2006, 10:55:53 PM
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!
Title: Re: Recent Topics and User Name
Post by: manuelap on February 22, 2006, 07:05:45 AM
I have exactly the same question! How to get the author in the recent topics block
Title: Re: Recent Topics and User Name
Post by: iowamf on February 22, 2006, 07:38:23 AM
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?  :)
Title: Re: Recent Topics and User Name
Post by: WebMasterZ on February 22, 2006, 12:58:03 PM
RC2 allready does this!
Title: Re: Recent Topics and User Name
Post by: manuelap on February 22, 2006, 01:18:31 PM
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....
Title: Re: Recent Topics and User Name
Post by: manuelap on February 22, 2006, 01:26:53 PM
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++;
    }
}



Title: Re: Recent Topics and User Name
Post by: bloc on February 22, 2006, 11:44:30 PM
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. 
Title: Re: Recent Topics and User Name
Post by: manuelap on February 23, 2006, 05:34:40 AM
Thank you very much for this fix. I had already found a work around through using block snippets, but this looks beautiful!
Title: Re: Recent Topics and User Name
Post by: resurgence on February 23, 2006, 05:36:27 AM
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?
Title: Re: Recent Topics and User Name
Post by: technodragon73 on February 23, 2006, 05:45:17 AM
I used this fix and it works great...however, the default theme folder has a different code than what was applied here...
Title: Re: Recent Topics and User Name
Post by: bloc on February 23, 2006, 06:05:53 PM
Quote from: resurgence on February 23, 2006, 05:36:27 AM
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?

Yes, it is. I added that after the post, so the bold name will be in as well.

Quote from: technodragon73 on February 23, 2006, 05:45:17 AM
I used this fix and it works great...however, the default theme folder has a different code than what was applied here...

It might be slightly different in different versions of TP...but the basic code would simply to add the line with the author. That should work across all versions of TP.
Title: Re: Recent Topics and User Name
Post by: resurgence on February 24, 2006, 03:49:38 AM
Quote from: Bloc on February 23, 2006, 06:05:53 PM
Quote from: resurgence on February 23, 2006, 05:36:27 AM
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?

Yes, it is. I added that after the post, so the bold name will be in as well.

xD i had no idea what i was doing (went in there withmy knowledge of html and xhtml alone. i know no php.)
Title: Re: Recent Topics and User Name
Post by: technodragon73 on February 24, 2006, 03:50:43 AM
Thanks Bloc...that did it so now all of my themes have the correct infor in the recnt block.
Title: Re: Recent Topics and User Name
Post by: RoarinRow on February 27, 2006, 03:12:20 PM
Hmmm, I had a Parse code error.
Title: Re: Recent Topics and User Name
Post by: Mitch on February 27, 2006, 03:13:08 PM
Any idea on how to center the thing if you have it in a center block as I do?

visit my webbie!
Title: Re: Recent Topics and User Name
Post by: bloc on February 28, 2006, 01:11:21 AM
Add a...

style="text-align: center;"

..to each of the divs in the code for recent topics.