News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

nneonneo's Shoutbox

Started by nneonneo, December 26, 2006, 06:58:11 PM

Previous topic - Next topic

RoarinRow

Quote from: akulion on December 27, 2006, 07:36:40 PM
delete the package file via FTP from ur Packages folder if u are getting an intrnal server error
that should fix it

otherwise if its another error, then post it here and maybe i or someone else can help out

That did it, thanks Aku    ;)

SMF 2.0
TP 1.0 RC1.1
Wordpress 3.1.3

Xarcell

Wow, I'm impressed. It works really well...

Do you think there is any chance you could make a chat version? Different rooms that load on different pages or something?

Gobo

#22
ok for those who want a demo u can see it on:
http://path-to-peace.com/forum
user: test
pass: test
Please note: kindly do not abuse this test account or post links using it!

As for custom theme modification, simply follow these instructions - Keep in mind! --> Not all themes are structured the same, so if the search for a code dosent give anything, try searching for a single line from that code until you find it and compare it to make sure it is pretty much the same! Small differences will exist!

This custom modification code is being posted up by reuest - im sure others will find it useful too.

Rule 1: Make a backup of your index.template.php file from your themes folder 1st!!!!

Then follow this:

Search for:

/* Internet Explorer 4/5 and Opera 6 just don't do font sizes properly. (they are big...)
Thus, in Internet Explorer 4, 5, and Opera 6 this will show fonts one size smaller than usual.
Note that this is affected by whether IE 6 is in standards compliance mode.. if not, it will also be big.
Standards compliance mode happens when you use xhtml... */
if ($context['browser']['needs_size_fix'])
echo '
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/fonts-compat.css" />';


ADD UNDER it:

// YSHOUT HERE
if($context['user']['is_logged'])
echo '
<script src="yshout/js/prototype.js" type="text/javascript"></script>
<script src="yshout/js/moo.ajax.js" type="text/javascript"></script>
<script src="yshout/js/behaviour.js" type="text/javascript"></script>
<script src="yshout/js/domFunction.js" type="text/javascript"></script>
<script type="text/javascript">

var myfunc = new domFunction(function()
{
',empty($options['collapse_header']) ? 'loadChat();':'','
}, { "yshout":"id"});

</script>
<script src="yshout/js/yshout.js?Oct112006" type="text/javascript"></script>
<script type="text/javascript">var shoutFile = "home.txt";</script>
<style type="text/css">
#yshout {
font-size: 10px;
}
#yshout p {
margin: 0 0 0; /* Top Bottom Linespacing */
}
.shout-invalid {
background: #FFFDD1;
}
#yshout fieldset {
border: none;
}
#yshout em {
font-style: normal;
}
#yshout p {
line-height: 1;
margin-top: 0;
}
#yshout {
overflow: hidden;
}
#yshout .shout-timestamp {
font-weight: normal;
color: #000;
}
#forum-name, #shout-text, #shout-button {
font-size: 9px;
margin: 0;
padding: 0;
}
#yshout #forum-name {
color: #666666;
width: 70px;
margin-right: 5px;
}
#yshout #shout-text {
color: #000000;
width: 310px;
margin-right: 5px;
}
#yshout #shout-button {
width: 55px;
}
#shouts .owner a {
color: #F00;
}
#shouts .moderator a {
color: #00F;
}
</style>';
// YSHOUT END


Search for:

// Guests don't have theme options!!
if ($context['user']['is_guest'])
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);';
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "', $context['session_id'], '");';

echo '
document.getElementById("upshrink").src = smf_images_url + (mode ? "/upshrink2.gif" : "/upshrink.gif");

document.getElementById("upshrinkHeader").style.display = mode ? "none" : "";
document.getElementById("upshrinkHeader2").style.display = mode ? "none" : "";


here ur search is LIKELY to fail, so I recommend searching for // Guests don't have theme options!! and comparing the code until u get to the last line of the above posted code.

And the ADD AFTER it:

// YSHOUT HERE
document.getElementById("yshout").style.display = mode ? "none" : "";
if(!mode)
{
loadChat();
}
// YSHOUT END


Finally comes the tricky part.
In different themes you may or may not have a user info area!
So incase the top userinfo area dosent exist then u will have to compensate and add this code somewhere where you would like to show the shoutbox.
THIS is the code which will finally display the shoutbox

Search for:

if (!empty($context['user']['total_time_logged_in']))
{
echo '
', $txt['totalTimeLogged1'];

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
}


Add after it:

// YSHOUT HERE
echo '
<br /><b>Shout Box</b><br /><br />
<div id="yshout"', empty($options['collapse_header']) ? '>' : ' style="display: none;">','...loading shoutbox...<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div>';
// YSHOUT END


THE END OF MODIFICATIONS!

Please note the colors for the text and all the rest of the stuff can be changed in the 1st part of the code posted - the css section specifies the colors.

enjoy

RvG

#23
aku... thanks for the info. I would like to use it inside TP. Is it possible?

BTW, still it didn't work to me. Using smf 1.1.1 php 4.

Shout Box

...loading shoutbox...

only this and nothing shows thereafter.

Gobo

yup u can use it inside TP as well

and I dont believe it will work with php 4 as mentioned earlier

Xarcell

the "loading shoutbox" is all I see on your site aku...

Gobo

oh yes sorry I forgot to add something lol

just a min

Gobo

#27
there fixed

the problem was simply this which everyone should compensate for....

In most TP enabled themes, you wont have the comfort of being able to add the shoutbox neatly in the area where guest permissions are checked by default.

The shoutbox does not work for guests, so one has to login to see it.

now if you experience the problem that the shoutbox is still visible as a guest then it will simply say "shoutbox loading" and never load, since guests cant really use it!

So to fix this theme glitch (we can call it)
do this:

the last part of the modification I gave, u shold add it as follows:

if ($context['user']['is_guest'])
echo'';
else
// YSHOUT HERE
echo '
<br /><b>Shout Box</b><br /><br />
<div id="yshout"', empty($options['collapse_header']) ? '>' : ' style="display: none;">','...loading shoutbox...<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div>';
// YSHOUT END


and that will take care of that issue

PS: u can login to my site as
user: test
pass: test

to see the actual shoutbox and test it out

Gobo

#28
a question for the mod author :

- how can I delete individual shouts? Do I have to do that from the tables via PHP myadmin?


found it
in yshout/chats/ folder

superboomz

i tried change the timezone but it didn't work.
i'm in bangkok, thailand
i changed from 'America/Regina' to 'Asia/Bangkok' but the timestamp still not sync with my local time. :S

kat

Hmmm. I'm getting "Shoutbox is loading in another window. Retrying..." and it just sits there.

Shame...

nneonneo

If you are using PHP <= 4, the timezone isn't set. I am looking into that problem.

If anyone gets a hung "loading shoutbox...", chances are that the shoutbox code (yshout/yshout.php) has errored. Please check your web server error log (not SMF's error log; it will log there).

1.03 should work with PHP 3 and 4 (but nothing older; if you have PHP 2 it's time to upgrade anyway :) )

AFAIK I may have to totally rework the timestamp to make it local-time compatible. If this is a big problem, you may wish to use one of the other shoutboxes in the meantime.


The shoutbox was designed to be loaded only once to avoid sucking bandwidth (I myself sometimes open every new topic in a separate tab, which could put a huge strain on server resources). It can be disabled by editing the yshout/js/yshout.js file: in the function loadChat, comment out the entire block of code that goes like this:
if(get_cookie("yShout_open"))
{
$("yshout").innerHTML="Shoutbox loaded in another window. Retrying...";
setTimeout("loadChat()",Math.random()*1000+1000/*between 1 and 2 seconds*/);
return;
}
set_cookie("yShout_open","true",3/*seconds*/);

and the shoutbox will load in all windows. Please be warned that this could potentially stress your server/hoster.
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

Gobo

hey i wanted to ask can moderators have control over shoutbox functions as well?

also can I restrict it by membergroup basis?

nneonneo

#33
For moderators, you can add this immediately after
$user=ssi_welcome('nothing'); // ssi_welcome only does something IF the parameter is 'echo'; otherwise the user data is returned!

in yshout/yshout.php:
if (loadMemberData(Array($user['id']),false,'minimal')!==false)
{
$group=$user_profile[$user['id']]['ID_GROUP'];
if(in_array($group,array(2,3)))
{
$user['is_mod']=1;
}
if(in_array($group,array(100,200,300)))
{
die("Sorry, you cannot access the shoutbox.");
}
}
else
{
die("Sorry, you must be logged in to post!");
}


Replace 2,3 with the IDs of moderators (usually 2 is Global Mod, 3 is Moderator); replace 100,200,300 with membergroups not allowed to access the shoutbox.

Note that the "banned" membergroups will still see the shoutbox; if you want to avoid that, you will have to edit the theme code (specifically, the part with the actual shoutbox; just wrap it in an if statement to check for correct access)

EDIT: fixed missing bracket
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

Gobo

thanks - this is a great shout box
thanks u very much for this wonderful contribution :D

Gobo

oh just 1 last thing

I want to reduce the size (width) of the typing text box

and also put a <HR> tag between shouts

is that possible and how?
thanks

nneonneo

Find this little block in index.template.php:
#yshout #shout-text {
color: #000000;
width: 310px;
margin-right: 5px;
}

Change the "310px" to anything else you like (make sure to have "px" on the end though)

As for having a <hr> after each shout, do you want to have that saved to disk, or only have it display to users (i.e do you want the <hr> to show up in the history?)
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

Gobo

the HR I just want displayed as html so that shouts get seperated like this:

User: hello etc etc
________________
User: hello etc etc
________________
User: hello etc etc

for formatting purposes basically

nneonneo

Find
return $chatText.' '; // hack: totally empty responses can break some browsers in the readChat function and replace the line with
return str_replace("\n","\n<hr>",$chatText.' '); // hack: totally empty responses can break some browsers

Hope that helps.
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

Gobo

Thanks :D

Here is the Tiny Portal Version of this mod for those who want to use the shout box in a side block.

Demo of TP side block shoutbox can be seen here
you MUST be logged in to see it
user: test
pass: test

Instead of the normal yshout.php file please use this modified one to compensate for the side block --> download yshout.php (modified)

Second thing you will need to do is carry out the modifications for index.template.php mentioned here BUT DO NOT include this last part in your index.template.php:

// YSHOUT HERE
echo '
<br /><b>Shout Box</b><br /><br />
<div id="yshout"', empty($options['collapse_header']) ? '>' : ' style="display: none;">','...loading shoutbox...<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div>';
// YSHOUT END


INSTEAD put the code below in a PHP block (left ot right block) and activate it only for members (not for guests because they wont be able to see the shoutbox either ways!


// YSHOUT HERE
echo '<div id="yshout"', empty($options['collapse_header']) ? '>' : ' style="display: none;">','...loading shoutbox...</div>';
// YSHOUT END

Advertisement: