This is the code I'm using in my PHP block to show Recent Forum Activity in our forums. How would I add "Last Post by..." to each listing as it is by default in the normal recent activity block?
$result=ssi_recentTopics(10,array(15),'return');
echo '<ul style="padding-left: 10px;">';
foreach($result as $my){
echo '<Li>'.$my['link'];
if(!$my['new'])
echo ' <a href="'.$my['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';
echo ' <br />';
echo ' ',$my['time'],'</Li>';
echo ' <hr>';
}
echo '</UL>';
echo'</center>';
echo '<span class="smalltext"></span>';
http://www.othersi.com
this is the code I use, it will give you "Last post by" at the top of the poster column.
use in a Front page Block or center block.
global $scripturl;
$what=ssi_recentTopics('10', NULL, 'array');
echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';
echo '<tr class="catbg3"><td valign="middle" align="left">Subject</td><td valign="middle" align="left">Board</td><td valign="middle" align="center">Last Post by</td><td valign="middle" align="left">Time</td></tr>';
foreach ($what as $topic)
{
echo '<tr><td class="windowbg" valign="middle" align="left">', $topic['link'];
// Is this topic new? (assuming they are logged in!)
if (!$topic['new'] && $context['user']['is_logged'])
echo '<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '</td><td class="windowbg2" valign="middle" align="left">', $topic['board']['link'], '</td>';
echo '</td><td class="windowbg2" valign="middle" align="left">', $topic['poster']['link'], '</td><td class="windowbg2" valign="middle" align="left">';
if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
echo '<a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';
echo '<span class="smalltext">', $topic['time'], '</span></td></tr>';
}
echo '</table>';
I don't want to change the table I have set up already, just would like to know what particular piece of code I'd need to add to my existing stuff to show the last post by info.
Asshandler --
I suggest you go change your [username] like Now!!
crip~
Would be nice not to have vulgar words in usernames. We try to keep this site as family oriented as possible. Thanks!
As to your question:
I think you're looking for this code ', $topic['poster']['link'], '
I've used this username for years, came from playing online and dominating the opposition, one day a guy called me the Asshandler because of the way I handed people their butts on a platter when I faced off against them online. It was funny because it was a typo, should have been Asshander. Been my username ever since. :p
Ichbin thanks for that snippet. :)
Hmmm where exactly would that snippet of code fit in with the exisiting code? Each place I attempt to insert it causes a parser error.
ooohh ok i thought u meant ass handler as in people who sell donkeys
no offence but its quite common word in my country an ass handler
so i didnt think twice of it at first
O.o I wasn't aware of the donkey meaning. lol
Post your code so we can see what you're doing. Can't tell you why you have an error if you don't do that.
$result=ssi_recentTopics(10,array(15),'return');
echo '<ul style="padding-left: 10px;">';
foreach($result as $my){
echo '<Li>'.$my['link'];
if(!$my['new'])
echo ' <a href="'.$my['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';
echo ' <br />';
echo ' ',$my['time'],'</Li>';
echo ' <hr>';
}
echo '</UL>';
echo'</center>';
echo '<span class="smalltext"></span>';
Where in there should the ', $topic['poster']['link'], ' go?
Here's what I've got right now... no errors, but no username appearing either...
$result=ssi_recentTopics('10', NULL, 'array');
echo '<ul style="padding-left: 10px;">';
foreach($result as $my){
Ã, echo '<Li>'.$my['link'];
Ã, if(!$my['new'])
Ã, Ã, echo ' <a href="'.$my['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';
echo ' <br />';
Ã, echo ' <span class="smalltext">
',$my['time'],' by ', $topic['poster']['link'], '
</span>
</Li>';
echo ' <hr>';
}
echo '</UL>';
echo ' <div align="center"><span class="smalltext">';
ssi_whosOnline();
echo' </span></div></center>';
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.othersi.com%2Fstorage%2Frecent.jpg&hash=a2dad76b8cb06deaaf24b07600d02e7b02be21f3)
Any ideas?Ã, I know I'm missing something, just not sure what.
Bump
I'm almost certain this is going to be a real simple thing and I'm going to feel like a fool for not seeing it. :p
should there not be a reference to the member or something along those lines to show the member that posted ???
if you look in your code where you have posted by there is no reference for the ssi to pull up the member that posted.
On a chance, looking at the code you're using Steve... I just changed your... ', $topic['poster']['link'], ' .... code to ...', $my['poster']['link'], ' ... and it works.
So simple... *smack*
Thank you.