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,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 561
  • Total: 561

Emote (/me) in shoutbox?

Started by eli, March 31, 2008, 02:36:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

eli

I'm aware that [me={name}]action text[/me] works. However, I would like to make the /me command work as well. I'm quite surprised it doesn't, but I haven't explored the Subs.php or Post.php enough to figure out if the /me is altered through Post or Subs.

Anyways, the original question, how can I alter the TP Shoutbox (verion 0.9.8 and SMF v 1.1.4) to allow for /me?

And to answer the question that's likely to arrive, I have searched. The search function returned 8 pages or results, out of which I found only one other topic which actually spoke of the /me command, but found no solutions there, only discussion.

G6Cad

There are no such function for the shoutbox, dont think it will be implemented eather for the next release

JPDeni

The translation of /me takes place in Subs-Post.php and what it does is


// Replace /me.+?\n with [me=name]dsf[/me]\n.


The code for the replacement follows that line.

I suppose you could try copying that code to the shoutbox function in TPortal.php, or possibly you could move it all to the doBBC function so that it's only in one place.

eli

I've looked through the TPortal.php, and it only makes the call to doUBBC for the content of the shouts, so I don't think there's anyplace appropriate to put that in there.

The only alternative is the doParseBBC function, but I can't seem to find a good place to put it. I think it would probably need reworking. I suppose I could ask over at SMF.org for more support on that.

JPDeni


I've looked through the TPortal.php, and it only makes the call to doUBBC for the content of the shouts, so I don't think there's anyplace appropriate to put that in there.

You might be able to put it before the call do doUBBC, I think. It would have to be there anyway, because the code from Subs-Post.php just translates it into BBC.

The SMF folks will likely tell you to come here. :)

eli

You wouldn't happen to be able to show where, would you? Have you looked at the code?

JPDeni

This is purely a guess. I'm guaranteeing nothing. :)

In Tinyportal.php, before

$shouts .= doUBBC(censorText($myshout));


add


$myshout = preg_replace('~(?:\A|\n)/me(?: | )([^\n]*)(?:\z)?~i', '[me=' . $user_info['name'] . ']$1[/me]', $myshout);


I haven't worked with preg_replace a whole lot and I'm not a whiz at regular expressions, so I'm just copying the SMF code as it is.

I doubt that this will cause a rift in the time/space continuum if it doesn't work ;) but I wouldn't try it first on an active site. Be sure that you use a test site first.

This website is proudly hosted on Crocweb Cloud Website Hosting.