TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 110
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 88
  • Total: 88

How to make shouting only available for admin ?

Started by knat, July 11, 2007, 05:28:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jpg

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>';
}
}

tick

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.

knat

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  ;)

tick

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.

knat

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.. :)

IchBin

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.

This website is proudly hosted on Crocweb Cloud Website Hosting.