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!
I have exactly the same question! How to get the author in the recent topics block
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? :)
RC2 allready does this!
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....
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++;
}
}
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.
Thank you very much for this fix. I had already found a work around through using block snippets, but this looks beautiful!
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?
I used this fix and it works great...however, the default theme folder has a different code than what was applied here...
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.
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.)
Thanks Bloc...that did it so now all of my themes have the correct infor in the recnt block.
Hmmm, I had a Parse code error.
Any idea on how to center the thing if you have it in a center block as I do?
visit my webbie!
Add a...
style="text-align: center;"
..to each of the divs in the code for recent topics.