Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: WhizzB in Juni 07, 2004, 09:22:25 VORMITTAG

Titel: Tag to show reader's name in message
Beitrag von: WhizzB in Juni 07, 2004, 09:22:25 VORMITTAG
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:
  [me=WhizzB] What are you looking for here? [/me]
that shows as
  /me  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.
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [Unknown] in Juni 07, 2004, 09:35:45 VORMITTAG
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:
// [me=Comment]does something[/me]
'/\[me=&quot;(.+?)&quot;\](.+?)\[\/me\](?:<br \/>)?/is',


Add after:
'~\[you( /)?\]~i',

And then find:
// Something "me" is doing.
'<div class="meaction">* $1 $2</div>',


And add right after that:
$context['user']['name'],

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


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

-[Unknown]
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: WhizzB in Juni 07, 2004, 03:32:24 NACHMITTAGS
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 ;-)

Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: Oldiesmann in Juni 07, 2004, 07:55:35 NACHMITTAGS
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.
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: nave in Juni 09, 2004, 04:47:25 VORMITTAG
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
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [Unknown] in Juni 09, 2004, 10:07:43 VORMITTAG
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]
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [MiNX]Tek in September 12, 2004, 10:08:57 NACHMITTAGS
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?
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [Unknown] in September 12, 2004, 10:29:32 NACHMITTAGS
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]
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [MiNX]Tek in September 13, 2004, 12:54:39 VORMITTAG
wow... okay, I think I got it.
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: Winters in September 15, 2004, 03:31:45 NACHMITTAGS
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.
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [Unknown] in September 15, 2004, 03:53:22 NACHMITTAGS
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]
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [MiNX]Tek in September 15, 2004, 06:34:05 NACHMITTAGS
OMG wow, that's a big "why not" replacement. Never heard of a "spoiler" tag. Hmmm, even more to contemplate about.
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [MiNX]Tek in September 15, 2004, 07:57:16 NACHMITTAGS
'~\[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?
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [Unknown] in September 16, 2004, 12:03:57 VORMITTAG
Sorry, that was an example of three *separate* things it could be.

-[Unknown]
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [MiNX]Tek in September 16, 2004, 04:08:06 VORMITTAG
Oh okay. But again, where do I put the code


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


If I wanted to use that.
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [Unknown] in September 16, 2004, 03:05:45 NACHMITTAGS
Zitat von: [Unknown] in Juni 07, 2004, 09:35:45 VORMITTAG
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:
// [me=Comment]does something[/me]
'~\[me=((?:&quot;)?)(.{1,80}?)\\1\](.+?)\[/me\](?:<br />)?~i' => '<div class="meaction">* $2 $3</div>',


And add after it:
'~\[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]
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: [MiNX]Tek in September 16, 2004, 05:13:58 NACHMITTAGS
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.
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: Anguz in September 18, 2004, 04:54:22 NACHMITTAGS
Zitat von: [MiNX]Tek in September 16, 2004, 05:13:58 NACHMITTAGS
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>',

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">
Titel: Re: Tag to show reader's name in message
Beitrag von: CapriSkye in November 08, 2004, 09:01:51 NACHMITTAGS
spoiler doesn't work :(

this is what i have

'~\[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>',
Titel: Re: Tag to show reader's name in message
Beitrag von: CapriSkye in November 09, 2004, 12:05:33 VORMITTAG
ok i did some search on google, and came up with this code,

<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... ;)
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: edi67 in November 09, 2004, 09:28:08 VORMITTAG
Zitat von: [Unknown] in September 15, 2004, 03:53:22 NACHMITTAGS
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]

where i must try to put this comand for hide topic?
Titel: Re: Tag to show reader's name in message
Beitrag von: Anguz in November 12, 2004, 04:02:28 NACHMITTAGS
For new tags without attributes (parameters), like the sarcasm tag mentioned in this topic, you can now use this mod
http://mods.simplemachines.org/index.php?mod=48
Titel: Re: Tag to show reader's name in message
Beitrag von: Anguz in November 13, 2004, 07:36:35 NACHMITTAGS
Spoiler Tag (http://www.simplemachines.org/community/index.php?topic=19831.0) ;)
Titel: Re: Tag to show reader's name in message
Beitrag von: EG in Februar 09, 2005, 02:29:14 NACHMITTAGS
I would like to create a bbc tag, so that when used, a line of text is shown first, and then what the person types between the tag.

I think I need to use echo.... but I cant figure it out, keep getting parse errors :-\
Titel: Re: Tag to show reader's name in message
Beitrag von: Ravenous in Mai 09, 2005, 12:27:23 NACHMITTAGS
I add an OoC(Out of Charakter) tag to my forum. What should i do with this code, that "Out of Charakter" is shown above that message like "Quote"?

Titel: Re: Tag to show reader's name in message
Beitrag von: Ravenous in Mai 14, 2005, 04:48:45 VORMITTAG
Just anyone?   ::)
Titel: Re: Tag to show reader's name in message
Beitrag von: [Unknown] in Mai 14, 2005, 10:15:36 NACHMITTAGS
'~\[ooc\](.+?)\[/ooc\]~i' => '<div class="quoteheader">Out of Character:</div><div class="quote">$1</div>',

-[Unknown]
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: oSa in September 03, 2005, 01:20:26 NACHMITTAGS
Zitat von: [Unknown] in Juni 07, 2004, 09:35:45 VORMITTAG
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:
// [me=Comment]does something[/me]
'/\[me=&quot;(.+?)&quot;\](.+?)\[\/me\](?:<br \/>)?/is',


Add after:
'~\[you( /)?\]~i',

And then find:
// Something "me" is doing.
'<div class="meaction">* $1 $2</div>',


And add right after that:
$context['user']['name'],

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


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

-[Unknown]

How can i add this tag using the custom bb code mod?
Titel: Re: Tag to show reader's name in message
Beitrag von: Rain501 in Dezember 13, 2005, 03:26:57 NACHMITTAGS
okie dokie..

1.1 is giving me beef..

in the subs.php file, firstly i tried adding this to the $codes array :


array(
'tag' => 'iframe',
'type' => 'unparsed_content',
'before' => '<iframe src="http://xyz.abc.com/$1.html" scrolling="no" frameBorder="0" height="240" width="104"></iframe>',
'after' => '',
),


which gives me errors...


Warning: main(/home/rain501/public_html/forums/Sources/Subs.php): failed to open stream: No such file or directory in /home/rain501/public_html/forums/index.php on line 48

Fatal error: main(): Failed opening required '/home/rain501/public_html/forums/Sources/Subs.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/rain501/public_html/forums/index.php on line 48


And the same if i tag that out side of the $codes object, above the 'bbc goes above this line' line.

I then tried sticking the full sarcasm tag, copied from above onto the line above the 'stick yer bbc code above this line' line.. ;)

Still the errors :(

Anyone willing to point out where i'm going wrong?

EDIT:

Sorted it by rejigging the Array vars, so its all gravy now :)
Titel: Re: Tag to show reader's name in message
Beitrag von: Vinspire in Juni 01, 2006, 12:38:44 VORMITTAG
This is a build in function in SMF 1.1 RC 2 right ?
Titel: Re: Is there a tag to show reader's name in message?
Beitrag von: topdog2k in August 29, 2006, 09:04:00 NACHMITTAGS
Zitat von: [Unknown] in Juni 07, 2004, 09:35:45 VORMITTAG
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:
// [me=Comment]does something[/me]
'/\[me=&quot;(.+?)&quot;\](.+?)\[\/me\](?:<br \/>)?/is',


Add after:
'~\[you( /)?\]~i',

And then find:
// Something "me" is doing.
'<div class="meaction">* $1 $2</div>',


And add right after that:
$context['user']['name'],

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


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

-[Unknown]

I know this thread is dead but I will ask anyways.  Can the [you] tag be modified so other information about the user can be displayed such as the users ip or email, etc...