Like it says on the can. How do i make it so only admin can use the shoutbox but all users can see the content ?
Set it so that only the admin can see it?
Under TP>Edit Blocks you can de-select everyone else, including moderators.
EDIT: Never mind, just reread your post Tank... my way would hide it from everyone.
Yes i need all to see but only me to use it... can it be done ?
Open up the TPortalBlocks.template.php file and find the spot where the textarea is for typing the shout. Add this code around it as a quick hack for this.
if ($context['user']['is_admin']){
echo 'textarea code in here';
}
This will just make the textarea not show for anyone unless they are an admin.
Thanks Ichbin, but the only place in that file i can find instance of shoutbox is this code.. and i cant seem to make out what part of the code is textarea.. maybe u can assist :)
function template_tpshoutbox()
{
global $settings, $txt, $context, $scripturl;
echo '
<div class="bordercolor" style="margin-left: 1ex;">
<table width="100%" cellpadding="4" cellspacing="1" border="0">
<tr class="titlebg">
<td colspan="6">'.$txt['shoutboxprofile'].'</td>
</tr>
<tr class="windowbg">
<td colspan="6" class="smalltext" style="padding: 2ex;">'.$txt['shoutboxprofile2'].'</td>
</tr>
<tr class="windowbg2">
<td colspan="6" style="padding: 2ex;">';
echo $txt['tp-prof_allshouts'].' <b>', !$context['TPortal']['profile_shouts_hide'] ? $context['TPortal']['all_shouts'] : '0' ,'</b><br />';
echo '
</td>
</tr>
<tr class="catbg">
<td align="center" width="10%" nowrap="nowrap">'.$txt[317].'</td>
<td align="center" class="smalltext" nowrap="nowrap">',$txt['tp-shout'],'</td>
<td align="center" nowrap="nowrap" width="10%">'. $txt['tp-edit'] .'</td>
</tr>';
if(!$context['TPortal']['profile_shouts_hide'] && isset($context['TPortal']['profile_shouts']) && sizeof($context['TPortal']['profile_shouts'])>0){
foreach($context['TPortal']['profile_shouts'] as $art){
echo '
<tr class="windowbg2">
<td valign="top" align="center" class="smalltext" nowrap="nowrap">',$art['created'],'</td>
<td valign="top" class="smalltext" >',$art['shout'],'</td>
<td valign="top" align="center">' , $art['editlink']!='' ? '<a href="'.$art['editlink'].'"><img border="0" src="'.$settings['images_url'].'/tpedit.gif" alt="" /></a>' : '' , '</td>
</tr>';
}
}
else
echo '
<tr class="windowbg2">
<td valign="top" align="center" class="smalltext" colspan="3">',$txt['tpsummary_shout'],' 0</td></tr>';
echo '
<tr class="windowbg">
<td colspan="6" style="padding: 2ex; font-weight: bold;">'.$context['TPortal']['pageindex'].'</td>
</tr>
</table>
</div>';
}
What version of TP are you using?
This is my shoutbox code.
// TPortal shoutbox
function TPortal_shoutbox()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
// Show the shoutbox, takes settings from tpadmin
if(isset($context['TPortal']['querystring']))
$tp_where=$context['TPortal']['querystring'];
else
$tp_where='';
if(!isset($context['TPortal']['shoutbox']))
$context['TPortal']['shoutbox']='';
if($context['TPortal']['shoutbox_usescroll']=='1')
echo '
<div id="marqueecontainer" onmouseover="copyspeed=pausespeed" onmouseout="copyspeed=marqueespeed">
<div id="vmarquee" class="smalltext" style="text-align: left;position: absolute; width: 98%;">
'.$context['TPortal']['shoutbox'].'
</div>
</div>';
else
echo '
<table cellpadding="0" align="center" width="100%" cellspacing="0" style="table-layout: fixed;">
<tr><td><div class="smalltext" style="width: 99%; height: '.$context['TPortal']['shoutbox_height'].'px; overflow: auto;">', $context['TPortal']['shoutbox'], '</div></td>
</tr>
</table>';
// show archives
if($context['TPortal']['show_shoutbox_archive']>0){
echo '
<div style="text-align: center; margin-top: 5px; " class="smalltext"><a href="',$scripturl,'?action=tpmod;sa=shoutbox;shouts='.$context['TPortal']['show_shoutbox_archive'].'">',$txt['tp-showshouts'],' ',$context['TPortal']['show_shoutbox_archive'],'</a></div>';
}
echo '
<form accept-charset="', $context['character_set'], '" class="smalltext" style="padding: 0; margin: 0; margin-top: 8px; text-align: center;" name="tp-shoutbox" action="'.$scripturl.'?action=tpmod;id=shout" method="post">';
if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest'])){
echo '<textarea class="smalltext" name="tp-shout" style="width: 80%;margin-top: 1ex; height: 50px;" wrap="auto"></textarea><br />';
echo '<input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'">';
}
if($context['user']['is_guest'] && $context['TPortal']['guest_shout'])
echo '<br /><input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'">';
else
echo '<input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'">
';
echo '<input name="tp-shout-url" type="hidden" value="'.htmlspecialchars($tp_where).'"><input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';
}
I dont know what version im using.. i got off the upgrading train a long time ago.. just simply got to many mods for that lol ;D
Anyway i think its impossible to tell what version i use because i removed the version number at some point :o
I didnt expect this to be so complicated.. there really should have been a permission system for the shoutbox in the first place if you ask me :P
So is it still possible to do with my old TP version ?
I don't think it's possible if there isn't a form on your shoutbox man...you sure you got that from the right place?
I believe the code you need to edit is in tportalblocks.template.php in the default theme.
The code i posted above is from my tportalblocks.template.php file ::)
My TP version is 0.9 is says so in the top of the file... so was something changed for shoutbox since that version ? I do have a text area because i use it when i use the shoutbox.. i just cant find it in the function :o
Edit.. i attached the file maybe it will clear thing up :)
Just copied this from your file you nub! lol I quoted so I could use BBC to point you to it. Don't worry Tank we still wub you. :D
Quote// TPortal shoutbox
function TPortal_shoutbox()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
// Show the shoutbox, takes settings from tpadmin
if(isset($context['TPortal']['querystring']))
$tp_where=$context['TPortal']['querystring'];
else
$tp_where='';
if(!isset($context['TPortal']['shoutbox']))
$context['TPortal']['shoutbox']='';
if($context['TPortal']['shoutbox_usescroll']=='1')
echo '
<div id="marqueecontainer" onmouseover="copyspeed=pausespeed" onmouseout="copyspeed=marqueespeed">
<div id="vmarquee" class="smalltext" style="text-align: left;position: absolute; width: 98%;">
'.$context['TPortal']['shoutbox'].'
</div>
</div>';
else
echo '
<table style="table-layout: fixed;" cellpadding="0" height="'.$context['TPortal']['shoutbox_height'].'" cellspacing="0" border="0" width="100%">
<tr>
<td class="smalltext">
<div style="height: '.$context['TPortal']['shoutbox_height'].'px; overflow: auto; width: 100%;">', $context['TPortal']['shoutbox'], '</div>
</td>
</tr>
</table>';
// show archives
if($context['TPortal']['show_shoutbox_archive']>0){
echo '
<div style="text-align: center; margin-top: 4px; " class="smalltext"><img height=16 alt="" hspace=2 src="http://www.gapeindex.dk/images/show.gif" width=15 align=absMiddle vspace=2 border="0" longDesc="" /><a href="',$scripturl,'?action=tpmod;sa=shoutbox;shouts='.$context['TPortal']['show_shoutbox_archive'].'">',$txt['tp-showshouts'],' ',$context['TPortal']['show_shoutbox_archive'],'</a>
<div><img height=10 alt="" hspace=4 src="http://www.gapeindex.dk/images/up.png" width=10 align=absMiddle vspace=4 border="0" /><a href="http://pix.nofrag.com/" target="_blank">Upload til Pix.nofrag.com</a></div>
<div><img height=10 alt="" hspace=4 src="http://www.gapeindex.dk/images/up.png" width=10 align=absMiddle vspace=4 border="0" /><a href="http://pixfarm.net/" target="_blank">Upload til PixFarm.net</a></div>
</div>';
}
echo '
<form class="smalltext" style="margin-top: 4px; text-align: center;" name="tp-shoutbox" action="'.$scripturl.'?action=tpmod&id=shout" method="post">';
if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest'])){
echo '<textarea class="smalltext" name="tp-shout" style="margin-top: 1ex; width: 90%; height: 40px;" wrap="auto"></textarea>';
echo '<input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'">';
}
if($context['user']['is_guest'] && $context['TPortal']['guest_shout'])
echo '<input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'">';
else
echo '<input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'">
';
echo '<input name="tp-shout-url" type="hidden" value="'.$tp_where.'"><input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';}
So this is the code you need.
// TPortal shoutbox
function TPortal_shoutbox()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
// Show the shoutbox, takes settings from tpadmin
if(isset($context['TPortal']['querystring']))
$tp_where=$context['TPortal']['querystring'];
else
$tp_where='';
if(!isset($context['TPortal']['shoutbox']))
$context['TPortal']['shoutbox']='';
if($context['TPortal']['shoutbox_usescroll']=='1')
echo '
<div id="marqueecontainer" onmouseover="copyspeed=pausespeed" onmouseout="copyspeed=marqueespeed">
<div id="vmarquee" class="smalltext" style="text-align: left;position: absolute; width: 98%;">
'.$context['TPortal']['shoutbox'].'
</div>
</div>';
else
echo '
<table style="table-layout: fixed;" cellpadding="0" height="'.$context['TPortal']['shoutbox_height'].'" cellspacing="0" border="0" width="100%">
<tr>
<td class="smalltext">
<div style="height: '.$context['TPortal']['shoutbox_height'].'px; overflow: auto; width: 100%;">', $context['TPortal']['shoutbox'], '</div>
</td>
</tr>
</table>';
// show archives
if($context['TPortal']['show_shoutbox_archive']>0){
echo '
<div style="text-align: center; margin-top: 4px; " class="smalltext"><img height=16 alt="" hspace=2 src="http://www.gapeindex.dk/images/show.gif" width=15 align=absMiddle vspace=2 border="0" longDesc="" /><b><a href="',$scripturl,'?action=tpmod;sa=shoutbox;shouts='.$context['TPortal']['show_shoutbox_archive'].'">',$txt['tp-showshouts'],' ',$context['TPortal']['show_shoutbox_archive'],'</b></a><br><div><img height=10 alt="" hspace=4 src="http://www.gapeindex.dk/images/up.png" width=10 align=absMiddle vspace=4 border="0" /><a href="http://pix.nofrag.com/" target="_blank">Upload til Pix.nofrag.com</a></div>
<div><img height=10 alt="" hspace=4 src="http://www.gapeindex.dk/images/up.png" width=10 align=absMiddle vspace=4 border="0" /><a href="http://pixfarm.net/" target="_blank">Upload til PixFarm.net</a></div>
</div>';
}
if ($context['user']['is_admin']){
echo '
<form class="smalltext" style="margin-top: 4px; text-align: center;" name="tp-shoutbox" action="'.$scripturl.'?action=tpmod&id=shout" method="post">';
if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest'])){
echo '<textarea class="smalltext" name="tp-shout" style="margin-top: 1ex; width: 90%; height: 40px;" wrap="auto"></textarea>';
echo '<input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'">';
}
if($context['user']['is_guest'] && $context['TPortal']['guest_shout'])
echo '<input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'">';
else
echo '<input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'">
';
echo '<input name="tp-shout-url" type="hidden" value="'.$tp_where.'"><input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';
}
}
I was thinking it would be more like // TPortal shoutbox
function TPortal_shoutbox()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
// Show the shoutbox, takes settings from tpadmin
if(isset($context['TPortal']['querystring']))
$tp_where=$context['TPortal']['querystring'];
else
$tp_where='';
if(!isset($context['TPortal']['shoutbox']))
$context['TPortal']['shoutbox']='';
if($context['TPortal']['shoutbox_usescroll']=='1')
echo '
<div id="marqueecontainer" onmouseover="copyspeed=pausespeed" onmouseout="copyspeed=marqueespeed">
<div id="vmarquee" class="smalltext" style="text-align: left;position: absolute; width: 98%;">
'.$context['TPortal']['shoutbox'].'
</div>
</div>';
else
echo '
<table style="table-layout: fixed;" cellpadding="0" height="'.$context['TPortal']['shoutbox_height'].'" cellspacing="0" border="0" width="100%">
<tr>
<td class="smalltext">
<div style="height: '.$context['TPortal']['shoutbox_height'].'px; overflow: auto; width: 100%;">', $context['TPortal']['shoutbox'], '</div>
</td>
</tr>
</table>';
// show archives
if($context['TPortal']['show_shoutbox_archive']>0){
echo '
<div style="text-align: center; margin-top: 4px; " class="smalltext"><img height=16 alt="" hspace=2 src="http://www.gapeindex.dk/images/show.gif" width=15 align=absMiddle vspace=2 border="0" longDesc="" /><b><a href="',$scripturl,'?action=tpmod;sa=shoutbox;shouts='.$context['TPortal']['show_shoutbox_archive'].'">',$txt['tp-showshouts'],' ',$context['TPortal']['show_shoutbox_archive'],'</b></a><br><div><img height=10 alt="" hspace=4 src="http://www.gapeindex.dk/images/up.png" width=10 align=absMiddle vspace=4 border="0" /><a href="http://pix.nofrag.com/" target="_blank">Upload til Pix.nofrag.com</a></div>
<div><img height=10 alt="" hspace=4 src="http://www.gapeindex.dk/images/up.png" width=10 align=absMiddle vspace=4 border="0" /><a href="http://pixfarm.net/" target="_blank">Upload til PixFarm.net</a></div>
</div>';
}
echo '
<form class="smalltext" style="margin-top: 4px; text-align: center;" name="tp-shoutbox" action="'.$scripturl.'?action=tpmod&id=shout" method="post">';
if ($context['user']['is_admin']){
echo '<textarea class="smalltext" name="tp-shout" style="margin-top: 1ex; width: 90%; height: 40px;" wrap="auto"></textarea>';
echo '<input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'">';
}
if($context['user']['is_guest'] && $context['TPortal']['guest_shout'])
echo '<input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'">';
else
echo '<input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'">
';
echo '<input name="tp-shout-url" type="hidden" value="'.$tp_where.'"><input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';}
But I am not a coder and could be wrong.
I must be needing new glasses then 8)
I used Ticks hack and it works smoothly - Thanks alot to you all for helping me solve this ;)
Cool. Glad to have helped you. I think the one above it would have kept the users from seeing the whole shoutbox unless there were a admin. I am learning code so I am not sure.
Well still this is good to have.. other might want to use the shoubox the same way i do it.. they will go to TP and search.. and they will find this topic.. :)
Quote from: Tank on July 12, 2007, 08:36:50 PM
they will go to TP and search.. and they will find this topic.. :)
ahahahahahahahahahaha! Thats a good one Tank.