Advertisement:

Author Topic: Tag to show reader's name in message  (Read 40310 times)

Offline WhizzB

  • Newbie
  • *
  • Posts: 2
Tag to show reader's name in message
« on: June 07, 2004, 09:22:25 AM »
Hi,

hope this is about the right place to ask this...

I'm  looking for a tag that would be replaced by the reader's user name, similar to
the {bbusername} tag in some other forums.

All I found about this issue was for IRC: 

> Woah...I just discovered the IRC "/me" little "Easter Egg"... 
> Are there any other such MODs already built in? Such as
> a "/you" function to display the reader's name?

but now, is there a similar thing for the posts on the forum?

I was told that <me> and </me> work on the forum too:
 
Code: [Select]
[me=WhizzB] What are you looking for here? [/me]that shows as
 
* WhizzB  What are you looking for here?
but that doesn't seem to have anything to do with getting the reader's name to the text.

Why I'd need this, is to write a story where the reader appears as one of the characters, so it's not really a question of life and death, but it'd be nice to get it working, anyway. So help is appreciated.
« Last Edit: October 30, 2004, 02:47:35 PM by A.M.A »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Is there a tag to show reader's name in message?
« Reply #1 on: June 07, 2004, 09:35:45 AM »
This is not a built in feature, but you can add it.  The way to add it, however, will be changing in the next version.  For the current version:

Sources/Subs.php, Find:
Code: [Select]
// [me=Comment]does something[/me]
'/\[me=&quot;(.+?)&quot;\](.+?)\[\/me\](?:<br \/>)?/is',

Add after:
Code: [Select]
'~\[you( /)?\]~i',
And then find:
Code: [Select]
// Something "me" is doing.
'<div class="meaction">* $1 $2</div>',

And add right after that:
Code: [Select]
$context['user']['name'],
In the next version, you'll find this in the same file:
Code: [Select]
// [me=Comment]does something[/me]
'~\[me=((?:&quot;)?)(.{1,80}?)\\1\](.+?)\[/me\](?:<br />)?~i' => '<div class="meaction">* $2 $3</div>',

And add after it:
Code: [Select]
'~\[you( />)?\]~i' => $context['user']['name'],
-[Unknown]

Offline WhizzB

  • Newbie
  • *
  • Posts: 2
Re: Is there a tag to show reader's name in message?
« Reply #2 on: June 07, 2004, 03:32:24 PM »
Thanks a lot for the info.

Unfortunately I'm no admin on that site, so that stuff goes beyond what I can do  there  :-[  and the admin prefers to wait for the new version, before letting ignorant newbies hack his databases ;-)


Offline Oldiesmann

  • Developer
  • SMF Super Hero
  • *
  • Posts: 24,814
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Is there a tag to show reader's name in message?
« Reply #3 on: June 07, 2004, 07:55:35 PM »
That change doesn't involve doing anything with the database at all. Just point them to this thread and they can make the changes themselves.
Michael Eshom
Webmaster / SMF Lead Developer
oldiesmann@simplemachines.org

Offline nave

  • Sr. Member
  • ****
  • Posts: 951
  • Gender: Female
Re: Is there a tag to show reader's name in message?
« Reply #4 on: June 09, 2004, 04:47:25 AM »
oh i really really like this. i think i'll add this on my board..

edit: as much i love this, i couldnt get it to work. i'm sure i did something wrong
« Last Edit: June 09, 2004, 05:06:40 AM by nave »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Is there a tag to show reader's name in message?
« Reply #5 on: June 09, 2004, 10:07:43 AM »
What happened?

Did you try it like this:

[you]

Or like this:

[you /]

Did it parse at all, just wrong, or not at all?

-[Unknown]

Offline [MiNX]Tek

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Male
  • Tek of MiNX Media, Ltd.
    • MiNX Media, Ltd.
Re: Is there a tag to show reader's name in message?
« Reply #6 on: September 12, 2004, 10:08:57 PM »
This is awesome, I have been wanting to add like commands to my forum (and my members wanted it as well) so.. now I can. You showed where the code is, but how to add my own? Like... I want to add a sarcasm code. So (without saying it later) you can do >>>

<sarcasm>That's the best thing I have ever heard!</sarcasm>

is there then a way to do this?

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Is there a tag to show reader's name in message?
« Reply #7 on: September 12, 2004, 10:29:32 PM »
Well, you could add...

'~\[sarcasm\](.+?)\[/sarcasm\]~i' => '-- $1 --',

I don't know how you'd want to format it, but basically you put in the second part the formatting.  So, that '-- $1 --' could be:

'<div style="color: green;">$1</div>'
'<div class="sarcasm">$1</div>'
'<div style="color: white; background-color: white;">$1</div>'

Or anything.

-[Unknown]

Offline [MiNX]Tek

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Male
  • Tek of MiNX Media, Ltd.
    • MiNX Media, Ltd.
Re: Is there a tag to show reader's name in message?
« Reply #8 on: September 13, 2004, 12:54:39 AM »
wow... okay, I think I got it.

Offline Winters

  • Jr. Member
  • **
  • Posts: 266
  • Gender: Female
    • DykesVision. Reality-based.
Re: Is there a tag to show reader's name in message?
« Reply #9 on: September 15, 2004, 03:31:45 PM »
Hrm, I'm probably totally wrong here, but I'll ask anyway: Is this the way I could add a "spoiler" Tag? (Meaning: By clicking on a "spoiler" button, the poster makes her enclosed text invisible unless people mark it with the right mouse button. The reader, at first, only sees the spoiler warning.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Is there a tag to show reader's name in message?
« Reply #10 on: September 15, 2004, 03:53:22 PM »
Yes... there is.  Why else would I have posted my cryptic reply to the "hide" topic?

Instead of '<div style="color: green;">$1</div>'... why not:

'<script language="JavaScript">var spolierid = Math.round(Math.random() * 10000); document.write(\'<a href="#" onclick="document.getElementById(&quot;spolier\' + spolierid + \'&quot;).style.display = &quot;&quot;; this.style.display = &quot;none&quot;; return false;">SPOILER: CLICK TO READ</a><span id="spoiler\' + spolierid + \'">\');</script>$1<script language="JavaScript">document.write(\'</span>\');</script>'

In theory, that shoudl hide it until you click to show.  If javscript is off, it won't be hidden at all.

-[Unknown]

Offline [MiNX]Tek

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Male
  • Tek of MiNX Media, Ltd.
    • MiNX Media, Ltd.
Re: Is there a tag to show reader's name in message?
« Reply #11 on: September 15, 2004, 06:34:05 PM »
OMG wow, that's a big "why not" replacement. Never heard of a "spoiler" tag. Hmmm, even more to contemplate about.

Offline [MiNX]Tek

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Male
  • Tek of MiNX Media, Ltd.
    • MiNX Media, Ltd.
Re: Is there a tag to show reader's name in message?
« Reply #12 on: September 15, 2004, 07:57:16 PM »
Code: [Select]
'~\[sarcasm\](.+?)\[/sarcasm\]~i' => '-- $1 --',
'<div style="color: green;">$1</div>'
'<div class="sarcasm">$1</div>'
'<div style="color: white; background-color: white;">$1</div>'

Why are their two color's? One white and one green? They are both refering to text right? Also, where in the Subs.php file do I put this?

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Is there a tag to show reader's name in message?
« Reply #13 on: September 16, 2004, 12:03:57 AM »
Sorry, that was an example of three *separate* things it could be.

-[Unknown]

Offline [MiNX]Tek

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Male
  • Tek of MiNX Media, Ltd.
    • MiNX Media, Ltd.
Re: Is there a tag to show reader's name in message?
« Reply #14 on: September 16, 2004, 04:08:06 AM »
Oh okay. But again, where do I put the code

Code: [Select]
'~\[sarcasm\](.+?)\[/sarcasm\]~i' => '-- $1 --',
'<div style="color: green;">$1</div>'

If I wanted to use that.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Is there a tag to show reader's name in message?
« Reply #15 on: September 16, 2004, 03:05:45 PM »
This is not a built in feature, but you can add it.  The way to add it, however, will be changing in the next version.  For the current version:

...

In the next version, you'll find this in the same file:
Code: [Select]
// [me=Comment]does something[/me]
'~\[me=((?:&quot;)?)(.{1,80}?)\\1\](.+?)\[/me\](?:<br />)?~i' => '<div class="meaction">* $2 $3</div>',

And add after it:
Code: [Select]
'~\[you( />)?\]~i' => $context['user']['name'],
-[Unknown]

So, instead of the thing it says to add there, add:

'~\[sarcasm\](.+?)\[/sarcasm\]~i' => '<div style="color: green;">$1</div>',

-[Unknown]

Offline [MiNX]Tek

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Male
  • Tek of MiNX Media, Ltd.
    • MiNX Media, Ltd.
Re: Is there a tag to show reader's name in message?
« Reply #16 on: September 16, 2004, 05:13:58 PM »
Okay, great thanks :) Wow, that was easy, lol. I just imagined it to be harder. I got it so that it's green, and bold. But how to I make it italicised? I'm looking in the other PHP files to try to find the code for italicze, but I'm not seeing it.
« Last Edit: September 17, 2004, 02:47:43 AM by [MiNX]Tek »

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Is there a tag to show reader's name in message?
« Reply #17 on: September 18, 2004, 04:54:22 PM »
Okay, great thanks :) Wow, that was easy, lol. I just imagined it to be harder. I got it so that it's green, and bold. But how to I make it italicised? I'm looking in the other PHP files to try to find the code for italicze, but I'm not seeing it.

'~\[sarcasm\](.+?)\[/sarcasm\]~i' => '<div style="color: green; font-weight: bold; font-style: italic;">$1</div>',[/color]

Edit:

Better even, create a new class in style.css named .sarcasm

.sarcasm
{
   color: green;
   font-weight: bold;
   font-style: italic;
}


and then change the above div tag to

<div class="sarcasm">
« Last Edit: September 29, 2004, 07:52:14 PM by Anguz »
Cristián Lávaque http://cristianlavaque.com

Offline CapriSkye

  • Full Member
  • ***
  • Posts: 574
    • Open
Re: Tag to show reader's name in message
« Reply #18 on: November 08, 2004, 09:01:51 PM »
spoiler doesn't work :(

this is what i have
Code: [Select]
'~\[spoiler\](.+?)\[/spoiler\]~i' => '<script language="JavaScript">var spolierid = Math.round(Math.random() * 10000); document.write(\'<a href="#" onclick="document.getElementById(&quot;spolier\' + spolierid + \'&quot;).style.display = &quot;&quot;; this.style.display = &quot;none&quot;; return false;">SPOILER: CLICK TO READ</a><span id="spoiler\' + spolierid + \'">\');</script>$1<script language="JavaScript">document.write(\'</span>\');</script>',

Offline CapriSkye

  • Full Member
  • ***
  • Posts: 574
    • Open
Re: Tag to show reader's name in message
« Reply #19 on: November 09, 2004, 12:05:33 AM »
ok i did some search on google, and came up with this code,
Code: [Select]
<b>Spoiler:</b> <input type="button" value="Show" style="width: 45px; font-size: 10px; margin:0px; padding:0px;" onClick="if (document.getElementsByTagName('div')[2].style.display !='')
{
document.getElementsByTagName('div')[2].style.display =''; this.innerText = ''; this.value = 'Hide';
}
else
{
document.getElementsByTagName('div')[2].style.display = 'none'; this.innerText = ''; this.value = 'Show';
}">
</div>

<div style="width:50%">
<div style="display: none; margin: 3px; padding: 6px; border: 1px solid;">
This is a spoiler
</div>

now i just gotta find a way to put it in smf... ;)