The shout box is HUGELY popular on my site, we have both parents and teenagers and depending on the time of day we have up to four or five people using the shout box as a "chat" while they move around our site. I *like* that so I don't want to change it persay because it's a really awesome tool to keep them involved and to say "hello" in a quick way...
That said I have tried to set the number of shouts to display really high to keep them from scrolling off because we all like to read through from the day/night before...but even when I set it high, it says above the shoutbox that they are there but when you click on it, there are not say...400, there are only maybe 100 or so...I would have to actually count them lol It's late, so I won't but they are scrolling off and disappearing despite me trying to save them.
So my questions are:
1) are the shouts permanently deleted when they scroll off or are they still "somewhere" out there?
2) is there a way to keep the shouts from ever scrolling off? Is there a way to keep them all? Is this an unrealistic thought on my behalf?? Is there another type of program I maybe should be using that will preserve the shouts but be as easy and functional as the shoutbox is?
If you have any ideas or suggestions for what I can do please let me know. I know that this is a LOVED part of our site, and I am sad when some of the cute/funny/crazy conversations float off of there so that no one can see them anymore.
Thanks in advance for any help anyone can give!
Blessings!
Susie
Okay I counted...boredom or morbid curiosity I do not know lol but the "show" page is only showing 100...so the change to make the "Show the last #" doesn't make it show more than 100...is there a place this can be changed?
Blessings!
Susie
And I checked inside the database and all of the shouts are stored in there in the tp_variables database...so they are not gone, just not showing up for whatever reason...I can't find a setting anywhere that might change that...
TPortal.php has the line:
if($limit>100) $limit=100;
so that sets the maximum at 100. There may be reasons for that.
I don't have a shoutbox active on my site, so I don't know exactly the way they're stored, but I'm sure you could keep the actual shoutbox at a total of 100 and then display earlier ones in a php block or article.
Ahh...okay...is there anyone who knows what those reasons are before I go messing with that code? I don't mind changing it unless it is going to mess something up and you are right JP there might be a REASON for that lol
So if you think it's possible to display the older ones in another block or article maybe someone who is WAY SUPERLY BEYOND wiser than *I* am could help me out with that...I don't do php I'm afraid...can change this and that here and there but haven't ever done anything heavy duty and would be afraid...php is SO unforgiving...I like html as basic as it is because it is VERY forgiving of stupid mistakes lol :laugh:
Blessings!
Susie
The shouts are stored in the database "until" you delete them. In otherwords, you can have thousands in there ( I know, most of my guild sites are running that many). However, even though they are still in the database, as JPD points out, there is a limit set in the TPortal.php file.
To the best of my knowledge, you can change that limit without issue. If you find some rare issue, simply change it back.
Good point, Thurnok. It's not hard to change things back if it seems to be a problem.
I can certainly help with coding a Shoutbox archive for you. I'll have to create one on my test site so that I can see how they're stored.
I would SO appreciate your help JP!! You are wonderful, thank you SO much!! I know that everyone on my site would be so excited to have the past conversations stored so that they could revisit them from time to time.
That is a good point too Thurnok, it is an easy enough change so if I break something I just use my backup to restore it back.
I have come here so many times with what must seem like silly or "duh" type questions and everyone here has always been so kind and generous of their time and talents--I just want to thank you most sincerely!
Blessings!
Susie
Don't forget to view someone's past shouts you can click on their profile and you'll see a link in there to view the shouts of that user. I know thats not what you're looking for, but I just wanted to make sure you knew that feature was there. :)
Okie-dokie. I only made two shouts on my site so I can't test out everything with this, but in theory ;) you should be able to paste this into a php article and it will print out the shouts from the database, in reverse order, with the most recent entry at the top. You can set the number of shouts you want to show on a page by changing the value of the $shouts_per_page variable. (That's the part I haven't tested fully, but I used the same code here that I've used elsewhere to make pages and it works perfectly.)
global $context,$scripturl;
$shouts_per_page = 100;
isset($_GET['p']) ? $p = $_GET['p'] : $p=1;
$page = $_GET['page'];
$start = ($p-1) * $shouts_per_page;
$tp_prefix = $context['tp_prefix'];
$query = db_query(
"SELECT *
FROM {$tp_prefix}variables
WHERE type = 'shoutbox'
ORDER BY value2 DESC
LIMIT $start, $shouts_per_page", __FILE__, __LINE__);
$shouts = '';
while($row = mysql_fetch_assoc($query))
{
$shouts .='<div style="margin: 4px;"><div style="border: dotted 1px; padding: 2px 4px 2px 4px;" class="windowbg2"><b>'.$row['value3'].'</b></div><div style="padding: 2px;"> '.timeformat($row['value2']).'</div><div style="padding: 4px;">';
$myshout='';
$myshout=$row['value1'];
$shouts .= doUBBC($myshout);
$shouts .= '</div></div>';
}
mysql_free_result($query);
echo $shouts;
$query = db_query(
"SELECT COUNT(*) as count
FROM smf_tp_variables
WHERE type = 'shoutbox'
GROUP BY type", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
mysql_free_result($query);
$total_shouts = $row['count'];
if ($total_shouts > $shouts_per_page)
{
$number_of_pages = intval($total_shouts/$shouts_per_page) + ($total_shouts%$shouts_per_page > 1);
echo '<div align="center">';
for ($i=1; $i<=$number_of_pages;++$i)
{
if ($i == $p)
echo ' ' . $i;
else
echo ' <a href="' . $scripturl . '?page=',$page,';p=' . $i . '">' . $i. '</a>';
}
echo '</div>';
}
I'll move this over to the snippets board to be tidy. :)