PDA

View Full Version : /me code Version 3


Pages : 1 [2]

buro9
02-17-2005, 09:58 PM
OK, This version takes care of edits too:

// HACK : START : ME
global $post;
if ('' == $post[username]) {
global $reputation;
if ('' == $reputation[username]) {
global $pm;
if ('' == $pm[fromusername]) {
global $postinfo;
if ('' == $postinfo[username]) {
$meUsername = ''; // Can't determine username
} else {
$meUsername = $postinfo[username];
}
} else {
$meUsername = $pm[fromusername];
}
} else {
$meUsername = $reputation[username];
}
} else {
$meUsername = $post[username];
}
$bbcode = preg_replace('#^/me (.*)$#im', "<span class=\"postAction\">*$meUsername \\1*</span>", $bbcode);
// HACK : END : ME


Remember to strip my formatting :)

I think new replies are already dealt with by the $post one are they not?

I can't find a scenario in which it no longer works on mine.

buro9
02-17-2005, 10:11 PM
Oh yeah... I see what you meant about the newreply bit... and yes, I think you do need it still.

In fact... I just tried to work around it... and you really need that bit still.

weaver
02-17-2005, 10:39 PM
Is this still ready to update? Or does the newreply bit need to be worked out first?

mholtum
02-17-2005, 11:07 PM
/me clicks install worked great

Viktor Kraft
02-18-2005, 12:37 AM
Sometimes this doesn't work.
If I do three /me in a row only the first "me" is parsed, the others no.

But I did a test here, and work. Did I do something wrong editing the files?

Diva
02-20-2005, 04:18 AM
Hi Erwin! Your hack is working great, except in PMs. I am using your quick PM hack also. When replying it shows "/me" instead of the person's name who sent the first PM. Could you help me with this? Thanks bunches!

Erwin
02-20-2005, 08:01 PM
Hi Erwin! Your hack is working great, except in PMs. I am using your quick PM hack also. When replying it shows "/me" instead of the person's name who sent the first PM. Could you help me with this? Thanks bunches!
Mmm... let me take a look when I find time...

Diva
02-20-2005, 08:02 PM
Thank you so much for all of your hard work. :)

zetetic
02-22-2005, 07:37 PM
Remember to strip my formatting :)

I think new replies are already dealt with by the $post one are they not?

I can't find a scenario in which it no longer works on mine.
Good job! :)

I've been using this modification (https://vborg.vbsupport.ru/showthread.php?p=484334#post484334) to make this hack work in PM's, message preview, etc. But it doesn't seem to work now with the latest version of this hack. Any idea how to incorporate these fixes? (For example right now if you use "/me" in a PM, when the person replies with quote it shows up as "/me" instead of with the name.)

Stryker[X]
02-28-2005, 10:00 PM
]Yep, unless there is more than one spot that code is in..


$pagetext = trim(strip_quotes($pagetext));
// /me Hack
$pagetext = preg_replace('#^/me(.*)$#im', "* $originalposter\\1", $pagetext);
// /me Hack
eval('$newpost[\'message\'] = "' . fetch_template('newpost_quote', 1, 0) . '";');

// fetch the quoted post title




edit: It works when the "/me" code is placed before the quote tags.

And to clarify, this is the only hack i am using. :)
* Stryker[X] starts to think...

Lets see here...on my forum, I have a double space after every /me enteree. Any ideas?

Eagle Creek
02-28-2005, 11:27 PM
Is it full 3.0.7 compatible?

MissKalunji
03-01-2005, 12:00 AM
Is it full 3.0.7 compatible?


yeah it works fine with me

MicroLinux?
03-01-2005, 03:13 AM
I dont have the time right now to read through this... But this is thehack where like.. you want to greet the user looking so you put "Hello/me," and /me will be their username? If it is... THANKS SO MUCH!

fridayweb
03-01-2005, 02:40 PM
I have a problem with the /me code being used within the vB Journal, created by Antonbomb22.

When someone types /me in that, it displays the name of the user VIEWING the journal, not the person who originally posted in their own journal.

Any suggestions on how to change that?

Deaths
03-01-2005, 02:48 PM
You should ask AN-net himself, as he coded the journal.

kcadd
03-12-2005, 09:55 AM
/me installs the /me hack :P

zetetic
04-13-2005, 03:28 PM
Good job! :)

I've been using this modification (https://vborg.vbsupport.ru/showthread.php?p=484334#post484334) to make this hack work in PM's, message preview, etc. But it doesn't seem to work now with the latest version of this hack. Any idea how to incorporate these fixes? (For example right now if you use "/me" in a PM, when the person replies with quote it shows up as "/me" instead of with the name.)
I'm replying to myself because I figured out what was wrong. All this time I thought Edgewize's solution (https://vborg.vbsupport.ru/showthread.php?p=484334#post484334) was a fix for this hack, but it's actually a completely different way of doing it that appears to do everything Erwin's does (even with Buro's mods) but works in quotes and previews too.

I know it's basically a thread hijack but there have been so many twists and turns on this thread it's really confusing. I'd love to know if Erwin or buro9 see anything wrong with doing it Edgewize's way, since it seems to work better...

TwinsForMe
05-10-2005, 06:58 PM
I'm having a conflict with the Multiquote hack (not the quick-reply multi-quote).

If I quote someone with multi-quote who has used /me, my username will be inserted. If I quote myself when I had used /me, my username will be replaced with /me.

Here is a screenshot:

TwinsForMe
05-14-2005, 02:59 PM
No one can help?

Erwin
05-15-2005, 03:59 AM
The /me code hack upgraded to version 3.00 thanks to Edgewize's suggestions - this fixes the parsing problems in quotes and PMs. :)


Just remove the old hack and follow the instructions in the first post.

Getox
05-15-2005, 06:51 AM
hey hey new version, might install this on my forum, even though my site is sitting there, useless music forum ;)
is / me install here?

* Getox tests

zetetic
05-15-2005, 02:54 PM
Excellent. Thanks for the update, Erwin. :)

TwinsForMe
05-15-2005, 03:12 PM
Thanks. :)

Logikos
05-17-2005, 11:32 AM
Erwin. For this to work in vB 3.0.7. You should change your instructions for private.php.

Should Be Find:

$pagetext = trim(htmlspecialchars_uni($pagetext));


Copy pasted code below:

Just wanted to let you know. :)

* Logikos rocks

boo.3
05-17-2005, 11:44 AM
/me loves this hack

jesus likes pie
05-30-2005, 02:28 PM
I cant find

$pagetext = trim($pagetext);

in my private.php


:\

Logikos
05-30-2005, 02:57 PM
Look 2 post up dude for an update.

jesus likes pie
05-30-2005, 03:16 PM
oh thanks.

Erwin
05-31-2005, 02:38 AM
Fixed the first post. :)

Logikos
05-31-2005, 04:45 AM
Thank you Erwin! :)

jesus likes pie
05-31-2005, 06:44 PM
mmm....i think its supposed to be reversed since the 3.0.7 one i cant find but i can find the 3.0.6 and below one...and yes, i have 3.0.7

I installed it yesterday but i got a new forum install and now that i try to install it again there is no color in it. What gives?

http://www.ugforums.org/ugforums/showthread.php?p=1171#post1171

jesus likes pie
05-31-2005, 06:47 PM
ah yes erwin you messed up i guess in the edit cause i found the code from yesterday. Anyways this is the right code:

// /me hack
if (THIS_SCRIPT == 'newreply' && !isset($bbcode) && isset($pagetext))
$pagetext = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$postinfo['username'].' $3', $pagetext);
elseif (THIS_SCRIPT == 'private' && !isset($bbcode) && isset($pagetext))
$pagetext = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$pm['fromusername'].' $3', $pagetext);
elseif (isset($bbcode) && $dobbcode && is_array($GLOBALS['post']))
$bbcode = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$GLOBALS['post']['username'].' $3', $bbcode);
elseif (isset($bbcode) && $dobbcode && $GLOBALS['previewpost'])
$bbcode = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$GLOBALS['bbuserinfo']['username'].' $3', $bbcode);
elseif (isset($bbcode) && $dobbcode && isset($GLOBALS['fromuserinfo']))
$bbcode = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$GLOBALS['fromuserinfo']['username'].' $3', $bbcode);
// /me hack

rob_daemon
07-16-2005, 10:18 PM
Erwin (or anybody else), can you update this for vB 3.5? This is one of the hacks that I need updated before I can go live with 3.5 on my site. Thanks!

Chris_D
07-22-2005, 01:31 PM
Any 3.5 versions would be great

VaaKo
09-10-2005, 10:00 PM
/me is testing it!

VaaKo
09-10-2005, 10:19 PM
Change "red" to whatever color you want.
I didn't understand this one!

I installed it on my forum but when I type: /me something
it shows in black, I want it to be in red, how to?

stan111
09-23-2005, 06:08 AM
i got this installed and it work perfectly however, somehow mine doesn't show up with color
that is so weird
any help ?
thanks in advance

edit: mine show up in black also

GatorV
10-07-2005, 03:48 AM
ah yes erwin you messed up i guess in the edit cause i found the code from yesterday. Anyways this is the right code:

// /me hack
if (THIS_SCRIPT == 'newreply' && !isset($bbcode) && isset($pagetext))
$pagetext = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$postinfo['username'].' $3', $pagetext);
elseif (THIS_SCRIPT == 'private' && !isset($bbcode) && isset($pagetext))
$pagetext = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$pm['fromusername'].' $3', $pagetext);
elseif (isset($bbcode) && $dobbcode && is_array($GLOBALS['post']))
$bbcode = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$GLOBALS['post']['username'].' $3', $bbcode);
elseif (isset($bbcode) && $dobbcode && $GLOBALS['previewpost'])
$bbcode = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$GLOBALS['bbuserinfo']['username'].' $3', $bbcode);
elseif (isset($bbcode) && $dobbcode && isset($GLOBALS['fromuserinfo']))
$bbcode = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$GLOBALS['fromuserinfo']['username'].' $3', $bbcode);
// /me hack


Great it works in 3.0.8 just some notes:

in newreply.php search for:

$pagetext = htmlspecialchars_uni($postinfo['pagetext']);
$pagetext = trim(strip_quotes($pagetext));


and in private.php:

$pagetext = trim(htmlspecialchars_uni($pagetext));


:cool:

BlackxRam
10-22-2005, 08:03 AM
Anyone get this to work with vb 3.5? I had this on my .9 board but to no avail the files are different now in 3.5.

Erwin? Can you make a quick port? lol =)

GoTTi
12-11-2005, 08:54 PM
i dont see "red" in the script. my colors are coming up black.

Hellcat
12-12-2005, 12:29 AM
Anyone get this to work with vb 3.5? I had this on my .9 board but to no avail the files are different now in 3.5.

Erwin? Can you make a quick port? lol =)
* Hellcat seconds this

I guess the code only has to be modified slightly and then drop it into right hook on the plugin system, right?
I just didn't figure it out yet :(


[EDIT]
OK, I think I got something going using Plugins and Hooks :)
At least it starts working like I intended :up:
I'll post it as soon as I have something more - In threads and PMs it's already parsing the "/me" and the PM one is even Quote-Save :D
Digging some deeper into it now....

[EDIT 2]
Well, well, after figuring out what hooks to use and what variables are available there the rest went quite well....

vB3.5.2 port of "/me" is here:
https://vborg.vbsupport.ru/showthread.php?t=102835