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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 629
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 524
  • Total: 524

Trick to getting shoutbox to appear?

Started by mmholt, November 20, 2010, 05:31:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ZarPrime

mmholt,

The reason that you are redirected to the Forum BoardIndex when making a shout is probably because you are using mod rewrite (otherwise none as queryless urls's).  This is a setting on your SMF Admin Features and Options page called something like "Search engine friendly URLs".  If you De-select that option, your Shoutbox will likely work correctly.  The code that controls this in TP is ...


// if using mod rewrite, go to forum
if(!empty($modSettings['queryless_urls']))
redirectexit('action=forum');
else
redirectexit(strip_tags($_POST['tp-shout-url']),false,true);
}


I will have to ask Ichbin if removing this is safe.  It was likely put in there to avoid conflicts with SMF Mods that rewite url's, like pretty url's, etc.

Ichbin, could you comment?

ZarPrime

mmholt

@WillyP - thanks a bunch, that worked great!

@ZarPrime - you were right, turning off that setting made the button work as expected.

Thank you guys so, so much. I really appreciate all the help. We didn't choose TinyPortal because we were using SMF - we chose SMF so we could use TinyPortal. I think it is an awesome product and I really appreciate all that you guys do for us.

IchBin

Thanks mmholt. If you'd like to, you can keep that setting on for friendly URL's. The code above that Zarprime posted is the culprit for the problem. You can just change it to this I believe.
Find this code in tp-files/tp-modules/TPShout/Sources/TPShout.php
// if using mod rewrite, go to forum
if(!empty($modSettings['queryless_urls']))
redirectexit('action=forum');
else
redirectexit(strip_tags($_POST['tp-shout-url']),false,true);


Replace with this:
        redirectexit(strip_tags($_POST['tp-shout-url']),false,true);

ZarPrime

Ichbin,

Again, I'm not sure why that was put in there for Mod Rewrite.  The same line is above on line 192 in the same file ...


if(empty($_POST['tp-shout-name']) && !$context['user']['is_logged'])
redirectexit(strip_tags($_POST['tp-shout-url']),false,true);

   $memID=-1;
   if($context['user']['is_logged'])
{

   $shout_name = '<a href="'.$scripturl.'?action=profile;u='.$context['user']['id'].'"';
$memID=$context['user']['id'];
if(!empty($context['TPortal']['usercolor']))
$shout_name .=' style="color: '. $context['TPortal']['usercolor'] . '"';

$shout_name .= '>'.$context['user']['name'].'</a>';
}
   $shout_time=time();
  // register the IP and userID, if any
$ip=$user_info['ip'];
if($shout!='')
  tp_query("INSERT INTO " . $tp_prefix . "shoutbox (value1,value2,value3,type,value4, value5) VALUES('". mysql_real_escape_string($shout)."','".$shout_time."','".$shout_name."','shoutbox','".$ip."',".$memID.")", __FILE__, __LINE__);
}
// if using mod rewrite, go to forum
if(!empty($modSettings['queryless_urls']))
redirectexit('action=forum');
else
redirectexit(strip_tags($_POST['tp-shout-url']),false,true);
}


Maybe that whole Mod Rewrite routine could be removed without problems.  I don't know.

ZarPrime

IchBin

Bloc said he had his reason at one time. That's all I know. :)

This website is proudly hosted on Crocweb Cloud Website Hosting.