PDA

View Full Version : [Release v2] PM on add user to buddy list


tubedogg
29 Mar 2001, 07:59
This hack automatically sends a PM to a user when he or she is added to someone's buddy list. It works both when you add via the link in a profile, and when you add via the Edit Buddy List page in the User Control Panel. It does not send a message when a user is added to someone's ignore list, nor does it send a message when a user is removed from someone's buddy list. The message is configurable, and is sent "from" the board admin or a moderator. That is also configurable.

No demo or screenshot, since it happens behind the scenes and is never seen by anyone. :D

For version: v2 beta 3 (may work with beta 1 and beta 2, however it is untested with those versions).

Files needed: buddyadd.php, buddyupdate.php (see attached zip file).

Files to edit: member2.php, buddyadd.php, buddyupdate.php (see instructions below).

Instructions
1] Unzip the files buddyadd.php and buddyupdate.php to your hard drive.
2] Open member2.php in an ASCII text editor, such as Notepad (Windows), SimpleText (Mac), EditPlus, UltraEdit, TextPad, etc. (DO NOT use WYSIWYG HTML editors such as FrontPage, HotDog, DreamWeaver, etc. They will in all likelyhood screw up the file! I will not be able to support you if you edit the file in one of these programs.)
3] Find (around line 35)
$bbuserinfo[$var]=trim($bbuserinfo[$var]);
Right under this, add
include("buddyadd.php");
Find (around line 155)
$listids=trim($listids);
Right under this, add
include("buddyupdate.php");
4] Open buddyadd.php in an ASCII text editor (see direction #2 for more info on doing this).
5] On the second line, change the value of $fromuserid (it's set at 1 right now) to an admin or moderator's user id. That way, if someone replies to the PM, it goes to a moderator or an admin and not the user, who has no idea that a PM was sent when they added someone to their buddy list. Next, you can change the wording of the $message if you wish. Only edit it at the top (line 3), not in the middle. Keep in mind that unless your board allows HTML in messages, you cannot use HTML in your message. However, you *can* use vBCode. The default message gives a link for the recipient to send a PM to the user that added the recipient to their buddy list, and states that the message is automated and not to reply to it. Add "\n" (without the quotes) anywhere you want a new line to appear.
6] Repeat step #5, only in buddyupdate.php. I suggest you use the same wording in both, since both are sent upon addition to a buddy list.
7] Save member2.php, buddyadd.php, and buddyupdate.php, and upload them all to your main forums directory.

That's it! :)

Instructions are also included in the zip file (pmonadd.txt).

FEEDBACK WANTED! :D Likes/disklikes/modification requests all gladly accepted.

29 Mar 2001, 08:11
Loving it man, LOVING IT!

29 Mar 2001, 08:18
Great! I'm glad you like it.
Took me a while to realize (my dumbass self) that when you go through the Edit Buddy List page it uses a different function than when you add someone from their profile (getinfo) page. Once I got past that hump, and realized I couldn't use the same code on both sections :D it was smooth sailing. (Oh yeah, and then there was the part where it was sending me 8 emails telling me I had private messages that I didn't cause I forgot to change the email variable. Am I getting stupider??? :D)

Seriously, I'm glad you're loving it. ;)

JohnM
03 Apr 2001, 20:22
You should make your settings actual settings in vB, and the message a template...

conan
03 Apr 2001, 20:59
Nice hack man, great job as usual!

tubedogg
04 Apr 2001, 03:20
Originally posted by JohnM
You should make your settings actual settings in vB, and the message a template...

Unfortunately I'm not quite that talented just yet. I'll look into doing a better version a bit down the road.