News:

Wondering if this will always be free?  See why free is better.

Main Menu

Ultimate Shoutbox

Started by Grudge, March 28, 2004, 09:11:20 AM

Previous topic - Next topic

IamV

How can I set my shoutbox so that guests can't view it.  I would like it visible on all pages for members only.  I also don't want guests viewing the shout archive.

McNeo2

Quote from: IamV on January 21, 2006, 07:42:21 PMHow can I set my shoutbox so that guests can't view it.

if ($context['user']['is_logged'])
if (function_exists('smfshout'))
smfshout();



inside in another echo I don't know how to put it

Col

Quote from: IamV on January 21, 2006, 07:42:21 PM
How can I set my shoutbox so that guests can't view it.  I would like it visible on all pages for members only.  I also don't want guests viewing the shout archive.

I'm assuming that guests have no access to your forum, so why not put the call to the shoutbox in BoardIndex.Template.php file instead of the Index.php file? The shoutbox will only displayed on the index page, but I don't think it will show on your login page.

I'm sure that there will be another way to do this exactly as you'd wish, but if you don't get the answer you need, maybe what I've suggested Will work for you.

IamV

Actually guests do have access to a portion of my forum.  Some boards are guest view.  I would like it to only show up when a member is logged in.

I know it can be done as I've seen it on other SMF sites.

This looks like it would work, but where would I put it?

Quote from: McNeo2 on January 22, 2006, 01:59:06 PM

if ($context['user']['is_logged'])
if (function_exists('smfshout'))
smfshout();



inside in another echo I don't know how to put it

raiwatson

Quote from: Col on January 10, 2006, 10:31:07 AMIf you want to see what I have done, I have this in any template, and place my shoutbox to the main body of the forum:

Quote   // The main content should go here.  A table is used because IE 6 just can't handle a div.
   echo '
   <table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
      <td id="bodyarea" style="padding: 1ex 20px 2ex 20px;">';
}

function template_main_below()
{
   global $context, $settings, $options, $scripturl, $txt;

   echo '</td>
   <td valign="top" width="135">
      <div id="shouthead">Shoutbox</div>
      <div id="shoutbox"> ', smfshout(), '
      </div>
   </td><td width="18">&nbsp;</td>
   </tr></table>';

   // Show the "Powered by" and "Valid" logos, as well as the copyright.  Remember, the copyright must be somewhere!
   echo '

You'll need to adjust it place it in your header.

Also, from my CSS file:

Quote#shouthead {
   margin: 29px 0px 0px 0px;
   padding: 3px;
   background: #6b8eae;
   border: solid #828181;
   border-width: 1px 1px 0px 1px;
   color: #ffffff;
}

#shoutbox {
   padding: 0px 2px 2px 2px;
   border: solid #828181;
   border-width: 1px;
}


After MUCH reading, this worked great for me!  Except that the Shoutbox is wider than the body of the rest of the forum.  I tried changing the <td valign="top" width="135"> to a smaller number but it didn't make any difference.  (I have no idea, really, what these numbers mean; I'm just making wild guesses!)  Any suggestions?

This is a great mod - my members love it - and I've found a lot of info reading through this thread.  Thanks for any help you can give.

Col

Raiwatson,

Have you checked the width with the shoutbox in Admin-->Edit Features and Options. There you will find: "Scroll box width (pixels)". That number, 135, is pixels. You can also set the height. I forget how these sizes interact with the HTML I posted. And if recall, it interacts differently when you have scrolling enabled, to disabled. - Can't remember, exactly.

vodkarev

I'm trying to install this on 1.1 RC2

I try it through the packages menu but whenever I click "apply mod" I get "You cannot download or install new packages because the Packages directory or one of the files in it are not writable!" I've tried changing all the Permissions, I've even used the FTP option in the acutal SMF forum to set them even with them all set to 777 it still comes up with this error.

I've tried manually uploading the file and setting it's permissions but it still comes up with this error.

IamV

I got it.  I added:
if ($context['user']['is_logged'])

before the echo containing the shout code & now it's only visible to members after they've logged in.  :)

pipo_il_primero

hey great mod!

I am using the SSI function and have put the shoutbox in an INFRAME so that it can refresh every 15 seconds without refreshing the main webpage.

The only problem I have is that when it refreshes the text that you have been typing disspears as well, so you have to start all over again...

How can I solve this? I am very new to SSI and PHP coding, so some help is welcome...

PiP

Col

Quote from: IamV on January 26, 2006, 04:49:00 AM
I got it.  I added:
if ($context['user']['is_logged'])

before the echo containing the shout code & now it's only visible to members after they've logged in.  :)

8)

Col

#770
Quote from: pipo_il_primero on January 26, 2006, 04:08:16 PM
hey great mod!

I am using the SSI function and have put the shoutbox in an INFRAME so that it can refresh every 15 seconds without refreshing the main webpage.

The only problem I have is that when it refreshes the text that you have been typing disspears as well, so you have to start all over again...

How can I solve this? I am very new to SSI and PHP coding, so some help is welcome...

PiP

I think you will have to have the refresh as a button with the iframe, rather that it auto-refreshing. I tried doing this a while ago, but there were some problems. I can't remember what though. It was probably me, and not the idea that was faulty! :D

locatorr

Great Mod.
But is there a code available for popup smileys in the shoutbox and use them by click on it
Greetz Locatorr

www.locatorr.nl

OpTiCz

I too would like to know how to get the Message Box and Shout button on the same line.
Also, did someone here post how to get it to match the theme?

L0relei

Quote from: OpTiCz on January 29, 2006, 01:08:58 AM
I too would like to know how to get the Message Box and Shout button on the same line.
Remove <br /> at the end of this line in shout.template.php (~ line 204) :
<input type="text" value="', $txt['shoutbox_8'], '" name="message" size="16" maxlength="100" onfocus="if (this.value == \'', $txt['shoutbox_8'], '\')this.value=\'\'" /><br />

Quote from: OpTiCz on January 29, 2006, 01:08:58 AM
Also, did someone here post how to get it to match the theme?
I modified the file shout.template.php this way :
<?php



function template_shout_archive()

{

global $context$settings$options$txt$user_info$scripturl$modSettings;



echo '

<table border="0" cellspacing="0" cellpadding="4" align="center" width="100%">

<tr>

<td class="catbg" align="center">'
$txt['shoutbox_1'], '</td>

</tr><tr>

<td class="titlebg" align="left">'
$context['page_index'], '</td>

</tr><tr>

<td class="windowbg">'
;

foreach ($context['arc_shouts'] as $shout)

{

if (!empty($context['canDelete']))

echo '

<a href="'
$scripturl'?action=delete_shout;id='$shout['id'], '"><img src="'$settings['images_url'], '/deleteshout.gif" border="0" alt="X"></a>';

echo '

<span class="smalltext">' 
$shout['time'] . ' - ' $shout['link'], '</a> -' $shout['message'], "</span>" $modSettings['shoutsep'];

}



if ($modSettings['enablearchiveshout'] == && $context['canPost'])

template_shout_form();



echo '

</td>

</tr>

</table>'
;



// Pull the delete options for the administrator

if (!empty($context['canDelete']))

echo '

<p><table border="0" cellspacing="1" cellpadding="4" align="center" width="100%">

<tr>

<td class="catbg" align="center" colspan="2">'
$txt['shoutbox_42'], '

</td>

</tr>

<tr>

<td class="windowbg2" valign="top" width="50%">

<form action="'
$scripturl'?action=delete_shout_age" method="post">'$txt['shoutbox_2'], '

<input type="text" name="age" id="age" value="25" size="4" /> '
$txt['shoutbox_3'], '

</td>

<td class="windowbg2" valign="top">

<input type="submit" name="submit" value="'
$txt['shoutbox_5'], '" />

</form><br />

</td>

</tr><tr>

<td class="windowbg2" valign="top" width="50%">

<form action="'
$scripturl'?action=delete_all_shouts" method="post">'$txt['shoutbox_4'], ' '$modSettings['shoutlimit'], '

</td>

<td class="windowbg2" valign="top">

<input type="submit" name="submit" value="'
$txt['shoutbox_5'], '" />

</form>

</td>

</tr>

</table></p>'
;

}



function 
template_shout_box()

{

global $context$settings$options$txt$user_info$scripturl$modSettings$forum_version;



// Only do auto refresh if we have it enabled!

if (!empty($modSettings['shout_enableXML']))

{

// The code for handling auto refresh

if ($forum_version 'SMF 1.1')

echo '

<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/script_shout.js?1.03"></script>';



echo '

<script language="JavaScript1.2" type="text/javascript"><!--

setTimeout("doAutoReload();", 5000);



function doAutoReload()

{

if (window.XMLHttpRequest)

{

getXMLDocument("'
$scripturl'?action=shout_xml;xml", onDocReceived);

setTimeout("doAutoReload();", 5000);

}

}

function onDocReceived(XMLDoc)

{

// Where we create our new shouts.

var insertData = \'\';

// Number of shouts.

var numShouts = XMLDoc.getElementsByTagName("shout").length;

// Useful vars.

var shoutID, shoutMemberName, shoutMemberID, shoutMemberEmail, shoutCanDelete, shoutTime, shoutLink, shoutMessage;



// Do each shout in turn.

for (i = 0; i < numShouts; i++)

{

shoutID = XMLDoc.getElementsByTagName("shout")[i].getAttribute("id");



// If this shout exists... continue.

if (document.getElementById("shout_" + shoutID))

continue;



shoutMemberName = XMLDoc.getElementsByTagName("shout")[i].getAttribute("member_name");

shoutMemberID = XMLDoc.getElementsByTagName("shout")[i].getAttribute("member_id");

shoutMemberEmail = XMLDoc.getElementsByTagName("shout")[i].getAttribute("member_email");

shoutCanDelete = XMLDoc.getElementsByTagName("shout")[i].getAttribute("can_delete");

shoutTime = XMLDoc.getElementsByTagName("shout")[i].getAttribute("time");

shoutMessage = XMLDoc.getElementsByTagName("shout")[i].getAttribute("message");

shoutLink = XMLDoc.getElementsByTagName("shout")[i].getAttribute("link");



insertData = 

\'<div id="shout_\' + shoutID + \'">\';

if (shoutCanDelete)

insertData += \'<a href="'
$scripturl'?action=delete_shout;id=\' + shoutID + \'"><img src="'$settings['images_url'], '/deleteshout.gif" border="0" alt="X"></a> \';



insertData += shoutTime + \' \' + shoutLink + \' -\' + shoutMessage + \''
$modSettings['shoutsep'], '</div>\';';



// Do the actual insert.

if ($modSettings['shoutdir'] == 0)

echo '

setOuterHTML(document.getElementById("new_shout"), \'<span id="new_shout"></span>\' + insertData);'
;

else

echo '

setOuterHTML(document.getElementById("new_shout"), insertData + \'<span id="new_shout"></span>\');'
;

echo '

}

}

//--></script>'
;

}



echo '

<table width="100%" cellpadding="0" cellspacing="0" border="0">

<tr class="windowbg2">

<td class="smalltext>'
;



// Scrolling?

if ($modSettings['enablescrollshout'] == 1)

echo '

<marquee direction="'
$modSettings['shoutscrolldir'], '" width="'$modSettings['shoutscrollwidth'], '" 

height="'
$modSettings['shoutscrollheight'], '" scrollamount="'$modSettings['shoutscrollspeed'], '" 

scrolldelay="'
$modSettings['shoutscrolldelay'], '" onmouseover="this.stop()" onmouseout="this.start()">';



// Insert the shouts, top or bottom depending on direction.

if ($modSettings['shoutdir'] == 0)

echo '

<span id="new_shout"></span>'
;



// Loop through the shouts!

foreach ($context['shouts'] as $shout)

{

echo '

<div id="shout_'
$shout['id'], '">';

// If it's an admin - they get the delete button...

if (!empty($context['canDelete']))

echo '

<a href="'
$scripturl'?action=delete_shout;id='$shout['id'], '"><img src="'$settings['images_url'], '/deleteshout.gif" border="0" alt="X"></a>';

echo '

<span class="smalltext">' 
$shout['time'] . ' - ' $shout['link'], '</a> -' $shout['message'], "</span>" $modSettings['shoutsep'];

echo '

</div>'
;



}

// For inserting new shouts...

if ($modSettings['shoutdir'] != 0)

echo '

<span id="new_shout"></span>'
;



// End the marquee?

if ($modSettings['enablescrollshout'] == 1)

echo '

</marquee>'
;



echo '

<p><span class="smalltext"><a href="'
$scripturl'?action=shout_archive">'$txt['shoutbox_43'], '</a></span></p>';

echo '

</td>

</tr>'
;

}



function 
template_shout_form()

{

global $context$settings$options$txt$user_info$scripturl$modSettings$ID_MEMBER;



echo '

<tr class="windowbg2">

<td class="smalltext" align ="center">

<form action="'
$scripturl'?action=shout" method="post">

<input type="hidden" value="'
$context['qstr'], '" name="qstr" />

<input type="hidden" value="" name="email" />'
;



if ($user_info['is_guest'])

{

echo '

<input type="hidden" value="0" name="memberID" />

<input type="text" value="'
$txt['shoutbox_6'], '" name="displayname" maxlength="100" onfocus="this.value=\'\'" /><br />';



if (empty($modSettings['shout_noGuestEmail']))

echo '

<input type="text" value="'
$txt['shoutbox_7'], '" name="email" maxlength="100" onfocus="this.value=\'\'" /><br />';

}

else

echo '

<input type="hidden" value="'
$user_info['name'], '" name="displayname" />

<input type="hidden" value="'
$ID_MEMBER'" name="memberID" />';



echo '

<input type="text" value="'
$txt['shoutbox_8'], '" name="message" size="100" maxlength="100" onfocus="if (this.value == \''$txt['shoutbox_8'], '\')this.value=\'\'" />

<input type="submit" name="submit" value="'
$txt['shoutbox_9'], '" />

</form>

</td>

</tr>

</table>'
;



}



// This template handles the xml refresh things...

function template_xml_shout()

{

global $context$settings$options$txt$modSettings;



echo '<''?xml version="1.0" encoding="'$context['character_set'], '"?''>

<smf>'
;

foreach ($context['shouts'] as $shout)

{

echo '

<shout id="'
$shout['id'], '" can_delete="'$context['canDelete'], '" time="'$shout['time'], '" member_email="'$shout['email'], '" member_id="'$shout['memberID'], '" member_name="'$shout['displayname'], '" message="'$shout['message'], '" link="'$shout['link'], '" />';

}

echo '

</smf>'
;

}



?>
Just Lo` It

Kattt

#774
Firstly, thanks Grudge for an awesome mod :) Been setting it up to work in Joomla and was looking great. Secondly apologies if I should be posting in a new topic. I have been setting up a site and figured I should upgrade to 1.1RC2 before I fully intergrate smf into joomla. So I did this but forgot to uninstall the mods SMF bridge and shoutbox first. Then I started getting issues applying mods, so tried a full fresh install of 1.1RC2 instead of an upgrade. I am still getting the same problem. When I try to apply the mod, it will fail on two tests.

5. Execute Modification ./index.php Test failed
10. Execute Modification ./ssi_examples.php Test failed


As I am a total nub I have no idea how to fix this :( Any help would be appreciated!

Edit: I have CHMOD the two files with no luck.

CrayZ

Hello and good luck with this mode.

The instalation of the mode was succesful but i don't know where to put this code  ???

if (function_exists('smfshout'))
  smfshout();


I want this mode to aper below the forum logo or on somwhere there above  :)

Is any one that can tell me on what line (place) of index.template.php I should do this modification.

Thanks again...

L0relei

If you put it in index.template.php the shoutbox will appear on every page of the forum. To show it below the menu, put it after :
// The main content should go here.
echo '
<div id="bodyarea" style="padding: 1ex 0px 2ex 0px;">';


If you put it in Boardindex.template.php it will appear only in the index. Put the code after :
function template_main()

{

global $context, $settings, $options, $txt, $scripturl, $modSettings;
Just Lo` It

CrayZ

Thanks a lot L0relei u helped a lot but i think i might need some more help to get this thing done.

So I did what u told me and went to the place I wanted to but it created a big space as u can see.



I make the message to move from left to right but is not moving from across the page.

What i want to do is to create just one string so the Shout ca be display on this place and the Shout to move from left to right. So I want to reduce this space as Mach as possible because I want only one Shout on the string moving from the left page of my forum to the end right.

The theme is adjusted @ 95% of them page so is not a fixed size. The size is always 95% of the screen.

I hope someone help me because I think I like this Shoutbox.

Goodbye.

L0relei

It seems that you didn't setup the shoutbox in the admin panel, there are options to do what you want.
Just Lo` It

CrayZ

Thanks a lot L0relei

You were a great help and I realy apriciate it. In any case so I can finalize my new ShoutBox i just need to more thingks to know:

The first one is where is the file that I can do the translation, and the second if possible where is the place so i can change the backround colour. If posible plese let me know.

Thanks again.

Take care my friend  ;)

Advertisement: