nneonneo's Shoutbox

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

Previous topic - Next topic

nneonneo

@Enders: You can edit the yshout/yshout.php file after the case "init": line. All the header stuff right before the shouts is printed in that section. For number of lines, use $max_lines.

@Niagra: The problem is that you put that in the middle of a PHP string, so it will not work.
1) <td>
//YSHOUT HERE

change to
<td>';
//YSHOUT HERE

2)    //YSHOUT END
</td>

change to
    //YSHOUT END
echo '</td>


@master2oo8: This means that your host has a low maximum connection limit. Try to see if it can be increased, or try the performance tips on the main mod page if you have a large forum.

@RobXduffy: Post an index.template.php. Donations can be posted to nneonneo [AT] gmail [DOT] com.

@kwilyan: Can you be more specific? I don't think there's a problem, since $chatFile and $logDir are both sanitized, and the script doesn't execute any of the contents (it just passes the contents through a few text filters to make it cleaner), but there's always a chance that I've missed a spot. If you could PM a URL or something which is potentially dangerous, I'd really appreciate it.

@edi67: custom theme?

@denio: That problem was resolved in version 1.13 by stripping prototype.js.

@NIBOGO: Default theme -- Themes/default/yshout-style.css.
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!

master2oo8

Quote
@master2oo8: This means that your host has a low maximum connection limit. Try to see if it can be increased, or try the performance tips on the main mod page if you have a large forum.
i have a dedicated server, what/where i must change to fix this?

nneonneo

I don't know, cPanel, maybe.
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!

Enders

#2203
I added scrolling to my shoutbox and everytime a new message is sent, it doesn't auto scroll down to that post. It also happens when it first loaded. Also, stop the auto scroll if the scroll bar isnt all the way down.

master2oo8

@nnenneo
i added the shoutbox in the board description with this code:

<div id="yshout">',$txt['yshout_loading'],'<br />
[/quote]
but you have written that this method is NOT recommended. maybe is that the error?

btw i wanted to change the refresh time, so i edited the yshout.js and changed "var refreshTime = 30000;", but it dont have effect :(

ameo

I made sort of guide for dummies, or something like that, to place this shoutbox in News field, and make it look cool on forum.
Personally, I believe this is the best position for shoutbox, and if you don't need News on your forum you could place shoutbox instead.


NOTE: I wrote tutorial and it works for 1.17 !!!

NOTE 2: With nneonneo's help - this works like a charm with version 1.21 also :)
            For 1.21 installation see step 4 instead of step 1, and then 
            follow all other steps normally.


STEP 1
First steps you already know, but I'll repeat it just in case;

First download yShout and install it.
If you're using different theme than default one after

echo '
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/fonts-compat.css" />';


you must add this code into your index.template.php :

// YSHOUT HERE
global $boardurl;
echo '
<script src="',$boardurl,'/yshout/js/prototype.js" type="text/javascript"></script>
<script src="',$boardurl,'/yshout/js/moo.ajax.js" type="text/javascript"></script>
<script src="',$boardurl,'/yshout/js/behaviour.js" type="text/javascript"></script>
<script src="',$boardurl,'/yshout/js/domFunction.js" type="text/javascript"></script>
<script type="text/javascript">

var myfunc = new domFunction(function()
{
loadChat();
}, { "yshout":"id"});
var board_url = "'; $boardurlparsed = parse_url($boardurl); echo (isset($boardurlparsed['path'])?$boardurlparsed['path']:""), '";

</script>
<script src="',$boardurl,'/yshout/js/yshout.js?Mar072008" 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;
}
#yshout .adminlink {
font-size: 6pt;
color: #141414;
}
#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;
}
</style>';
// YSHOUT END



Then do this:


Of course you need news box to be displayed in order to see shoutbox in your index page.
To do that go to Theme options and click to:

1. DISABLE eNews   [it is very dangerous to leave it enabled, so if it is checked,
    you must uncheck it]

&
[/]


2. Show news fader on board index [check it]

3. fading delay - set to 0

Click save, then in News box put this code

a) for 1.15-1.17       <div id="yshout">',$txt['yshout_loading'],'


b) for 1.21             
<div id="yshout">Loading shoutbox...</div>

instead of putting second code somewhere else:

And save it.


If you wish to change News to Shout box or Shoutbox you'll need to find file index.english-utf8.php / index.english.php or of  any other language file you're using.  They are stored under Forum/Themes/default/languages/  In there you'll need to edit string    $txt[102] = 'News';   
to   $txt[102] = 'Shoutbox';  and re-upload that file to it's place. You'll need to replace old file with that new-one if you didn't delete old one first. 



// GUIDE FOR DUMMIES IS FINISHED //
I guess that's it. I hope it shall be helpful to at least someone.[/]


Step 4 is actually step 1 FOR 1.21 installation


In index.template.php, after
   // If we're in a board, or a topic for that matter, the index will be the board's index.
   if (!empty($context['current_board']))
      echo '
   <link rel="index" href="' . $scripturl . '?board=' . $context['current_board'] . '.0" />';

add
   // YSHOUT HERE - <head> code
   global $boardurl,$shoutFile;
   $shoutFile='home';
   $scripturlparsed = parse_url($scripturl);
   $scriptpath=isset($scripturlparsed['path'])?$scripturlparsed['path']:'/';
   $args='';
   foreach($_GET as $key => $value) // passthrough $_GET
      $args.='&'.urlencode($key).'='.urlencode($value);
   echo '
   <script src="',$boardurl,'/yshout/js/moo.ajax.js" type="text/javascript"></script>
   <script src="',$boardurl,'/yshout/settings.js" type="text/javascript"></script>
   <script type="text/javascript"><!-- // --><![CDATA[
   window.onload=function(){loadChat();};
   var shoutFile="',$shoutFile,'";
   var yshout_php="',$scriptpath,'?yshout',$args,'";
   // ]]></script>
   <script src="',$boardurl,'/yshout/js/yshout.js?July062008" type="text/javascript"></script>
   <style type="text/css">
      #yshout {
         font-size: 10px;
         overflow: hidden;
      }
      #yshout #yshout-toollinks { /* tool links (History, Commands, etc.) */
      }
      #yshout #shouts { /* main shouts area */
      }
      #yshout .shout { /* one shout */
         margin: 0 0 0; /* Top Bottom Linespacing */
         line-height: 1;
      }
      #yshout .shout-timestamp {
         font-style: normal;
         font-weight: normal;
      }
      #yshout .shout-adminlinks { /* del and ban buttons */
         font-size: 6pt;
         color: #141414;
      }
      #yshout #shout-form {
         margin: 0;
         padding: 0;
      }
      #yshout #shout-form fieldset {
         border: none;
      }
      #yshout #forum-name {
         width: 70px;
         margin-right: 5px;
      }
      #yshout #shout-text {
         width: 310px;
         margin-right: 5px;
      }
      #yshout #shout-button {
         width: 55px;
      }
      #yshout .shout-invalid { /* invalid shout (shout textbox) */
         background: #FFFDD1;
      }
   </style>';
   // YSHOUT END - <head> code




Best of luck 2 everyone[/hr]
antechinus:
QuoteIf you are dying for a solution it may be wise to seek medical attention.
Get some Awesome Smileys for your forum

|±(ಠ_ಠ
)±|

RobXduffy

@ nneonneo  Here it is. Can you make it so membergroup 4 cant see the shoutbox. thank you nneonneo

markvon

I got a big issue. After i uninstall the shoutbox and all the files are gone, i still keep getting a

SHOUT BOX

Loading Shoutbox at the top of my page! Why is this so? How can i remove it?? Its irritating as hell!

Kindly help me

mjltigger

Hi I now have the blank index.htm and no shoutbox appearing on my pages at all.. I am using English, smf 1.1.5 and the Dilber Multicolor theme

Cobra97

I'd like to know if there is any way to change the font color for the box where it says [Today at 05:06:44 PM]  Right now it's black and I have a darkgray background and it's ver hard to see.

I couldn't find it in the style.css

Thanks


_Anthony_

Quote from: NIBOGO on May 07, 2008, 07:15:59 PM
nnenneo i dont know what i have to modify in that file to have the scroll

i can upload my yshout-style.css and you can modify that part????

thanks
Why not just read? It says what you need to change

Enders

How do you put it under the stats box with a bar labeling shoutbox?

ameo

Quote from: Cobra97 on May 07, 2008, 06:25:31 PM
I'd like to know if there is any way to change the font color for the box where it says [Today at 05:06:44 PM]  Right now it's black and I have a darkgray background and it's ver hard to see. I couldn't find it in the style.css

In the first code you added to your index.php, to display shoutbox, is actually some .css.
Here is the line you need to edit:

#yshout .shout-timestamp {
font-weight: normal;
color: #000;
antechinus:
QuoteIf you are dying for a solution it may be wise to seek medical attention.
Get some Awesome Smileys for your forum

|±(ಠ_ಠ
)±|

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

[unplugged]

#2215
Today is a good day.  :D

I have been struggling with an "upshrink" for the shoutbox for a while and I have seen others ask for it once or twice. I finally managed to get it to work so it only takes up space if the viewer is using it. See it here.

It's nothing more than an alteration of the Info Center upshrink. (After quite a while of scratching my head as to why it wouldn't work, I finally noticed that I had never added the proper variable to the database!  :P )

Maybe nneonneo can add it to this fantastic mod as an option.  ;D
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



ameo

SunKing, could you maybe post some instructions how to do it?
antechinus:
QuoteIf you are dying for a solution it may be wise to seek medical attention.
Get some Awesome Smileys for your forum

|±(ಠ_ಠ
)±|

[unplugged]

#2217
I will certainly try.  :P

My theme is a butchered version of the default them, so with that in mind, there may need to be some adjustments to make it work in your particular case. My code is also chopped up bits I've assembled to fit my needs. Don't expect it to be pretty.  ;D

[EDIT]: This is for SMF2.0+. SMF 1.x does not support smfToggle which is what is used to make the shoutbox collapse. Sorry for any confusion.  :P

in the index.template.php

find this
</head>

and before it add this
// script for shoutbox upshrink
  echo'<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
// Create the shoutbox header object.
var sbHeader = new smfToggle("upshrinkSB", ', empty($options['collapse_shoutbox']) ? 'false' : 'true', ');
sbHeader.useCookie(', $context['user']['is_guest'] ? 1 : 0, ');
sbHeader.setOptions("collapse_shoutbox", "', $context['session_id'], '");
sbHeader.addToggleImage("upshrinkSB", "/upshrink.gif", "/upshrink2.gif");
sbHeader.addTogglePanel("upshrinkSBHeader");
sbHeader.addTogglePanel("upshrinkSBHeader2");
// ]]></script>';


find this
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()


and before it add this
function shoutbox()
{
  global $txt, $options, $settings;

echo'<div class="catbg" style="padding: 5px 5px 5px 10px;border-top:1px solid #ffffff;"><a href="#" onclick="sbHeader.toggle(); return false;"><img id="upshrinkSB" src="', $settings['images_url'], '/', empty($options['collapse_shoutbox']) ? 'upshrink.gif' : 'upshrink2.gif', '" alt="*" title="', $txt['upshrink_description'], '" align="bottom" /></a>&nbsp;';
// Block Title
echo'<span width="100%"></span><span>ShoutBox</span>';

echo'</div><div id="upshrinkSBHeader"', empty($options['collapse_shoutbox']) ? '' : ' style="display: none;"', '>
<table border="0" width="100%" cellspacing="1" cellpadding="1" class="bordercolor" style="margin-top: 1px;">
<tr>
<td  class="windowbg" width="6%" align="left" valign="top">';
// SHOUTBOX HERE
echo '<div>
   <div id="yshout"><table  height="306px">&nbsp;</table></div>';
echo'</div>';
// SHOUTBOX END
echo'     </td>
</tr>
</table></div></div>';
echo '
<table id="upshrinkSBHeader2"', empty($options['collapse_shoutbox']) ? '' : ' style="display: none;"', ' width="100%" cellpadding="4" cellspacing="0" border="0">
<tr>';
}


finally, find this
// Show the menu here, according to the menu sub template.
template_menu();


and add before it this
echo' </table>', shoutbox(), '</div></table>';


In my theme layout, this puts the shoutbox neatly tucked between the user info area and the menu buttons. Depending on your theme, for that last step, you simply put shoutbox(); wherever you want the shoutbox to appear. You may have to alter things such as <table>'s or <div>'s to get it to come out desireable for you. Mine was through simple trial and error.

Oh, and I almost forgot (again), mine didn't seem to work right until I added the variable to my database. I just went in and manually INSERTed the info (1, 1, collapse_shoutbox, 1) into smf_themes. I have no idea how to write a script for that but I am sure the gurus in here can. My coding knowledge is hopelessly small.

Hope this helps.

[EDIT]  I removed the "minimize by default" setting -- it minimized on every page load/refresh...
[EDIT]  Thanks to ameo for bringing a few errors to my attention (now corrected).
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



Cobra97

Quote from: ameo on May 08, 2008, 03:50:37 AM
Quote from: Cobra97 on May 07, 2008, 06:25:31 PM
I'd like to know if there is any way to change the font color for the box where it says [Today at 05:06:44 PM]  Right now it's black and I have a darkgray background and it's ver hard to see. I couldn't find it in the style.css

In the first code you added to your index.php, to display shoutbox, is actually some .css.
Here is the line you need to edit:

#yshout .shout-timestamp {
font-weight: normal;
color: #000;

Thank You ameo.............That did the trick!

nneonneo

#2219
@Enders: There's an autoscroll mod somewhere in this thread. Unfortunately, the search feature on this topic seems to be a bit broken, so I can't locate it.
EDIT: Found it. See http://www.simplemachines.org/community/index.php?topic=137508.msg1532028#msg1532028 for reposted guide.

As for your second question: the following puts it under Forum Stats, but above Users Online.
In Themes/default/BoardIndex.template.php, before
// "Users online" - in order of activity.
echo '
<tr>

add
// YSHOUT HERE
echo '<tr>
<td class="titlebg" colspan="2">Shoutbox</td>
</tr><tr>
<td class="windowbg2" width="100%" colspan="2"><div id="yshout">',$txt['yshout_loading'],'<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div></td></tr>';
// YSHOUT END


@master2oo8: refreshTime is only half of the refresh system. The other half is controlled by $updateTimeout.

You need to change refreshTime, then update what comes after yshout.js? in index.template.php (if you don't, cached copies of the JS will cause problems).

After a day or so, to let the changes be visible, reduce $updateTimeout and you should notice the reduction in refresh speed.

@ameo: Nice guide! I will make a note of it on the mod page. As for the shout button, I think the Modifications.english.php file should have the right text for yshout_shout_button...

@RobXduffy: Use
// YSHOUT HERE
if(loadMemberData(Array($context['user']['id']),false,'profile')!==false)
{
global $user_profile;
$userData=$user_profile[$context['user']['id']];
$membergroups=$userData['additionalGroups']; // use additional_groups for SMF2
$membergroups=explode(',', $membergroups);
$membergroups[]=$userData['ID_GROUP']; // use id_group for SMF2
$membergroups[]=$userData['ID_POSTGROUP']; // use id_post_group for SMF2
if (count(array_intersect(array(4), $membergroups)) == 0)
echo '
<br /><b>Shout Box</b><br /><br />
<div id="yshout">',$txt['yshout_loading'],'<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div>';
}
// YSHOUT END

in place of the original block.
Note that this doesn't entirely revoke access, but it merely hides the shoutbox.
To completely disable it for these users, you must also do the changes suggested for yshout.php:
after
if (count(array_intersect($moderatorGroups, $membergroups)) > 0)
$user['is_mod']=true;

add
if (count(array_intersect(array(4), $membergroups)) > 0)
die('Sorry, you can't access the shoutbox.');


@markvon: If you want to completely remove the shoutbox, go to index.template.php and remove the three or four blocks of code between // YSHOUT HERE and // YSHOUT END.

@mjltigger: Blank index.htm? You need to manually install the shoutbox for Dilber MC. This has been covered before, and it is a matter of following the directions on the main mod page for installing to other themes.

@edi67: Should be in index.template.php of the custom theme, per the instructions on the main mod page. There's a large CSS block there.
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!

Advertisement: