vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   AutoPM after addBuddy (https://vborg.vbsupport.ru/showthread.php?t=104872)

Antivirus 01-08-2006 10:00 PM

AutoPM after addBuddy
 
What: This will send an automatic PM to a user after you add him/her to your Buddy List. The PM you automatically sent is saved within your outfolder and the Admin can modify the title and message of the PM by changing the phrases.

1 Product (1 plugin and 2 phrases)

Versions / Features:
  • 1.0.0 - released on 1/9/06
  • 1.0.1 - added automatic approval link into body of PM received by user
    added a check to prevent looping of the PM if the receiver already has the sender on his/her buddylist
  • 1.0.2 - added an anti-harassment link in the PM to deter users from "annoying" others into becoming their friends.
    added link so receiver of PM can easily view sender's profile.
  • 1.0.3 - cleaned up code and added link for recipient of PM to view sender's profile from within PM
  • 1.0.4 - Fixed bug which was wrongly sending PM to someone when user added someone to his/her ignore list
To Install: Just import the xml file as a product from within AdminCP>PluginSystem>ManageProducts>Add/ImportProduct

To change the title of the PM, edit $vbphrase[anti_autopm_bud_tit], and to change the message of the PM, edit $vbphrase[anti_autopm_bud_mes].

PLEASE REMEMBER TO BACKUP BEFORE YOU INSTALL!

Thanks: Thanks to Andreas for writing the [HowTo] Send PM's Automatically. This was inspired by Cloud Warrior's really cool vbFriends hack, which lacked this functionality and it seemed like many people would want it.

about: I'm taking this out of beta, as i think it's working all right by now. Any advice on how to improve this, comments, or bugs - are more than welcome, as I will do my best to address all.

If you use this, please click the install thingie :)

.

Antivirus 01-09-2006 03:36 PM

First post reserved ;)

The Chief 01-09-2006 03:41 PM

holy crap, I think I will like this and install it for sure, just gimme two secs :)

Wonders, im so happy ;)

The Chief 01-09-2006 04:02 PM

ok, first suggestion, it seems to work fine but you need to allow HTML and PHP so that we can make reference to usernames and link back if you know what I mean.

Here is what i tried to make which will be normal for any users to do is to aprove the new fried request so that they both become new friends.



Quote:

Hello, I just added you to my Friend List. If you would like to be friends, please add me to yours. Thanks! :)

<a href="profile.php?$session[sessionurl]do=addlist&amp;userlist=buddy&amp;u=$userinfo[userid]">Approve $userinfo[username] as your friend!</a>

Antivirus 01-09-2006 04:22 PM

Quote:

Originally Posted by gamebgs
need to allow HTML and PHP so that we can make reference to usernames and link back if you know what I mean.

I was trying to figure that out, without enabling html across the whole boards. But I couldn't figure out how to get the html to display properly, as adding the html in the phrase just causes the html code to be displayed. :(

I'm sure there's a way to get the html enabled just for this specific instance of sending a PM, and not across the entire PM system, i just need to find out how.

It would be nice if there were another field in the PM datanager such as:
$pmdm->set('allowhtml', 1); but no such luck.

I'll try to figure it out... great idea!

vwturbo 01-09-2006 04:34 PM

Good work for your first product. I installed it and quickly tested it and it works just like it should. gamebgs and I were anxiously awaiting this.

Antivirus 01-09-2006 04:35 PM

thanks for the kind words :)

The Chief 01-09-2006 04:44 PM

Quote:

Originally Posted by Antivirus
I was trying to figure that out, without enabling html across the whole boards. But I couldn't figure out how to get the html to display properly, as adding the html in the phrase just causes the html code to be displayed. :(

I'm sure there's a way to get the html enabled just for this specific instance of sending a PM, and not across the entire PM system, i just need to find out how.

It would be nice if there were another field in the PM datanager such as:
$pmdm->set('allowhtml', 1); but no such luck.

I'll try to figure it out... great idea!

thank you, hope it works out great, as it would be cool to use the $userinfo[username] instance in the title also to do something like this...


We would also need some statements like if he approves, do not send a PM, can this be done??

msimplay 01-09-2006 06:07 PM

i used vbuddies plugin and the sendpm doesn't work aswell as this one however it might be worth taking a look at the plugin for it to help with variables it
has a link to their profile in it

The Chief 01-09-2006 06:09 PM

Quote:

Originally Posted by msimplay
i used vbuddies plugin and the sendpm doesn't work aswell as this one however it might be worth taking a look at the plugin for it to help with variables it
has a link to their profile in it

cool, I hope you will take a look at this Antivirus :)

jj 01-09-2006 06:20 PM

Hi there,

I've installed it and it works. I have some suggestions for future versions. I could do them all by myself but I don't have the time at the moment ;)
  • Possibility to send the pm from a defined user account or from the user who added the recipient. For example: I use a "Bot" to store some external information into the forum. He could also be used to send the pm. Maybe some others would like that, too.
  • After a quick look on your code, I found there is no check if the recipient already has added the sender to his buddy list. If that happens maybe another phrase should be chosen without a sentence like "If you would like to be friends, please add me to yours", i.e. just "I've added you to my buddy-list" or "User $1 has added you to his buddy-list". Got my idea? :)

If more gets into my mind, I'll post it.

jj 01-09-2006 06:28 PM

Quote:

Originally Posted by gamebgs
thank you, hope it works out great, as it would be cool to use the $userinfo[username] instance in the title also to do something like this...

That's quite easy and a quickie. Here we go:

1) Find in original code
Code:

        $pmdm->set('title', $vbphrase[anti_autopm_bud_tit]);
        $pmdm->set('message', $vbphrase[anti_autopm_bud_mes]);

2) Replace with
Code:

        $anti_autopm_bud_tit = str_replace("$1",$vbulletin->userinfo['username'],$vbphrase[anti_autopm_bud_tit]);
        $pmdm->set('title', $anti_autopm_bud_tit);
        $anti_autopm_bud_mes = str_replace("$1",$vbulletin->userinfo['username'],$vbphrase[anti_autopm_bud_mes]);
        $pmdm->set('message', $anti_autopm_bud_mes);

3) Use $1 in the phrases where you like to get the username

The Chief 01-09-2006 06:42 PM

Quote:

Originally Posted by j.jacobsen
That's quite easy and a quickie. Here we go:

1) Find in original code
Code:

        $pmdm->set('title', $vbphrase[anti_autopm_bud_tit]);
        $pmdm->set('message', $vbphrase[anti_autopm_bud_mes]);

2) Replace with
Code:

        $anti_autopm_bud_tit = str_replace("$1",$vbulletin->userinfo['username'],$vbphrase[anti_autopm_bud_tit]);
        $pmdm->set('title', $anti_autopm_bud_tit);
        $anti_autopm_bud_mes = str_replace("$1",$vbulletin->userinfo['username'],$vbphrase[anti_autopm_bud_mes]);
        $pmdm->set('message', $anti_autopm_bud_mes);

3) Use $1 in the phrases where you like to get the username

wow, thanks for this, but now is there a way to put a link in there somewhere, like I think you should be able since you got this to work...

Like a link of what i posted before for that user to automatically add him (approve)??

thanks!!

Snoop-It 01-09-2006 08:02 PM

excellent hack! using it on my board aswell.. thanks for this!

Antivirus 01-09-2006 08:08 PM

i didn't see any of your new posts until i just got this requested feature added. i was able to use a custom BBcode in order to avoid having to enable HTML in PMs globally, so now the approval link thingie in the PM message body seems to work. Let me know how it works for you.
:)

The Chief 01-09-2006 08:17 PM

Quote:

Originally Posted by Antivirus
i didn't see any of your new posts until i just got this requested feature added. i was able to use a custom BBcode in order to avoid having to enable HTML in PMs globally, so now the approval link thingie in the PM message body seems to work. Let me know how it works for you.
:)

there seems to be an error,

XML Error: mismatched tag at Line 80

I can't even upload it...

Antivirus 01-09-2006 08:20 PM

ok, looking at it...

Snoop-It 01-09-2006 08:23 PM

damm just tried upgrading and i got this error.. when importing the product..

XML Error: mismatched tag at Line 80

The Chief 01-09-2006 08:23 PM

Quote:

Originally Posted by dholaholic
damm just tried upgrading and i got this error.. when importing the product..

XML Error: mismatched tag at Line 80

he said he was looking at it ;)

Snoop-It 01-09-2006 08:26 PM

yeh i posted straight away.. i didnt see that post - my bad.. :nervous:

Antivirus 01-09-2006 08:32 PM

ok i fixed it i think I zipped the wrong file that time sorry:smoke:

Snoop-It 01-09-2006 08:40 PM

excellent, now it works. cheers man!

Antivirus 01-09-2006 08:43 PM

cool

jj 01-09-2006 08:46 PM

Just looked into your changes ;) I think if you can use a self-made bbcode you also could use the standard url bbcode so there is no need to add a custom bbcode. You could do that by inserting
HTML Code:

[url=$2/profile.php?do=addlist&userlist=buddy&u=$3]click to accept[/url]
into the phrase. For example (a 3rd person message phrase version):
HTML Code:

Hello,

$1 has added you to his buddy-list. If you like to get friends you need to add $1 to your buddy-list, too.

[url=$2/profile.php?do=addlist&userlist=buddy&u=$3]Click here[/url] to add $1 to your buddy-list now.

The Board Admin

Now if you go on with the code I posted above to use the Username in the title and message, we get
Code:

$anti_autopm_bud_tit = str_replace("$1",$vbulletin->userinfo['username'],$vbphrase[anti_autopm_bud_tit]);
$pmdm->set('title', $anti_autopm_bud_tit);
$anti_autopm_bud_mes = str_replace("$1",$vbulletin->userinfo['username'],$vbphrase[anti_autopm_bud_mes]);
$anti_autopm_bud_mes = str_replace("$2",$vbulletin->options['bburl'],$anti_autopm_bud_mes);
$anti_autopm_bud_mes = str_replace("$3",$vbulletin->userinfo['userid'],$anti_autopm_bud_mes);
$pmdm->set('message', $anti_autopm_bud_mes);

I haven't tested the above thing and don't know if it works, but you may work it out yourself :) Keep on the learning.

EricaJoy 01-09-2006 08:46 PM

cool beans, i'm sure i will be clicking install momentarily..

The Chief 01-09-2006 09:18 PM

Quote:

Originally Posted by j.jacobsen
Just looked into your changes ;) I think if you can use a self-made bbcode you also could use the standard url bbcode so there is no need to add a custom bbcode. You could do that by inserting
HTML Code:

[url=$2/profile.php?do=addlist&userlist=buddy&u=$3]click to accept[/url]
into the phrase. For example (a 3rd person message phrase version):
HTML Code:

Hello,

$1 has added you to his buddy-list. If you like to get friends you need to add $1 to your buddy-list, too.

[url=$2/profile.php?do=addlist&userlist=buddy&u=$3]Click here[/url] to add $1 to your buddy-list now.

The Board Admin

Now if you go on with the code I posted above to use the Username in the title and message, we get
Code:

$anti_autopm_bud_tit = str_replace("$1",$vbulletin->userinfo['username'],$vbphrase[anti_autopm_bud_tit]);
$pmdm->set('title', $anti_autopm_bud_tit);
$anti_autopm_bud_mes = str_replace("$1",$vbulletin->userinfo['username'],$vbphrase[anti_autopm_bud_mes]);
$anti_autopm_bud_mes = str_replace("$2",$vbulletin->options['bburl'],$anti_autopm_bud_mes);
$anti_autopm_bud_mes = str_replace("$3",$vbulletin->userinfo['userid'],$anti_autopm_bud_mes);
$pmdm->set('message', $anti_autopm_bud_mes);

I haven't tested the above thing and don't know if it works, but you may work it out yourself :) Keep on the learning.


this works great, but it sucks that it opens in a new window...

it would be better if it just opened in the same window, but good idea noneless ;)

msimplay 01-10-2006 07:39 AM

excellent addition but i have this hack that allows members to choose wether they save a copy of their pms or not and regardless of wether they have it turned on or off it still saves the pm any chance of making it adhere to the savecopy rules ?

https://vborg.vbsupport.ru/showthrea...light=savecopy

jj 01-10-2006 11:08 AM

Quote:

Originally Posted by msimplay
excellent addition but i have this hack that allows members to choose wether they save a copy of their pms or not and regardless of wether they have it turned on or off it still saves the pm any chance of making it adhere to the savecopy rules ?

https://vborg.vbsupport.ru/showthrea...light=savecopy

Don't want to Download the zip and look into it, but I looked into some postings. It seems there is a field added to the user table according to this post, so why don't you just try this:

Replace in Original code of the plugin:
Code:

$pmdm->set_info('savecopy', 1);
with
Code:

$pmdm->set_info('savecopy', $vbulletin->userinfo['savecopy']);

Revan 01-10-2006 12:48 PM

This is lush, I foresee this having a boatload of installs even if not HOTM (I always type HTML when I try to type HOTM :p)

Might I suggest using {1}, {2}, ... {n}, like so:
Change phrase "anti_autopm_bud_mes" to this:
HTML Code:

Hello,

{1} has added you to his buddy-list. If you like to get friends you need to add {1} to your buddy-list, too.

[url={2}/profile.php?do=addlist&userlist=buddy&u={3}]Click here[/url] to add {1} to your buddy-list now.

The Board Admin

Change the "anti_autopm_bud_tit" to this:
Code:

{1} has just added you to his buddy list!
Change this snippet of code:
PHP Code:

$anti_autopm_bud_tit str_replace("$1",$vbulletin->userinfo['username'],$vbphrase[anti_autopm_bud_tit]);
$pmdm->set('title'$anti_autopm_bud_tit); 
$anti_autopm_bud_mes str_replace("$1",$vbulletin->userinfo['username'],$vbphrase[anti_autopm_bud_mes]);
$anti_autopm_bud_mes str_replace("$2",$vbulletin->options['bburl'],$anti_autopm_bud_mes);
$anti_autopm_bud_mes str_replace("$3",$vbulletin->userinfo['userid'],$anti_autopm_bud_mes);
$pmdm->set('message'$anti_autopm_bud_mes); 

to this:
PHP Code:

$anti_autopm_bud_tit construct_phrase($vbphrase['anti_autopm_bud_tit'], $vbulletin->userinfo['username']);
$anti_autopm_bud_mes construct_phrase($vbphrase['anti_autopm_bud_mes'], $vbulletin->userinfo['username'], $vbulletin->options['bburl'], $vbulletin->userinfo['userid']);
$pmdm->set('title'$anti_autopm_bud_tit);
$pmdm->set('message'$anti_autopm_bud_mes); 

Saves inventing a whole new construct_phrase() function ;)

Again, nice work :)

msimplay 01-10-2006 03:46 PM

Quote:

Originally Posted by j.jacobsen
Don't want to Download the zip and look into it, but I looked into some postings. It seems there is a field added to the user table according to this post, so why don't you just try this:

Replace in Original code of the plugin:
Code:

$pmdm->set_info('savecopy', 1);
with
Code:

$pmdm->set_info('savecopy', $vbulletin->userinfo['savecopy']);

Thanks works great

jj 01-10-2006 05:31 PM

Quote:

Originally Posted by Revan
PHP Code:

$anti_autopm_bud_tit construct_phrase($vbphrase['anti_autopm_bud_tit'], $vbulletin->userinfo['username']);
$anti_autopm_bud_mes construct_phrase($vbphrase['anti_autopm_bud_mes'], $vbulletin->userinfo['username'], $vbulletin->options['bburl'], $vbulletin->userinfo['userid']);
$pmdm->set('title'$anti_autopm_bud_tit);
$pmdm->set('message'$anti_autopm_bud_mes); 

Saves inventing a whole new construct_phrase() function ;)

thx for that, learned something new now ^^

Antivirus 01-10-2006 08:36 PM

Jacobsen and Revan, both of your suggestions work, and great ideas for cutting out having to create the custom BBcode and improving the hack. Revan's idea uses slightly less code but I will experiment with the str_replace thingie (i am not that familiar with it yet).

Working on an update... thanks for the input people!

The Chief 01-10-2006 08:38 PM

Quote:

Originally Posted by Antivirus
Jacobsen and Revan, both of your suggestions work, and great ideas for cutting out having to create the custom BBcode and improving the hack. Revan's idea uses slightly less code but I will experiment with the str_replace thingie (i am not that familiar with it yet).

Working on an update... thanks for the input people!

thanks for taking care of this antivirus ;)

WNxWakko 01-10-2006 10:45 PM

What about the ignore list, does it work on that also?

The Chief 01-10-2006 10:46 PM

Quote:

Originally Posted by WNxWakko
What about the ignore list, does it work on that also?

I don't think it would be intelligent to send a PM to the user that you are ignoring, right??

akanevsky 01-10-2006 11:32 PM

Where are the files?

Exitilus 01-11-2006 12:22 AM

Yah *L* ... I'm looking and I don't see any .. heh :)

Antivirus 01-11-2006 01:53 AM

Quote:

Originally Posted by Psionic Vision
Where are the files?

oops, lol
:smoke:

The Chief 01-11-2006 02:10 AM

Quote:

Originally Posted by Antivirus
oops, lol
:smoke:

you might consider putting one of their two reccommendations in the next release. It is really important to at least mention the username once.

It makes them more unique, if you get what I mean...

Exitilus 01-11-2006 02:58 AM

Installed and Working fine :D


All times are GMT. The time now is 04:54 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01964 seconds
  • Memory Usage 1,868KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (11)bbcode_code_printable
  • (5)bbcode_html_printable
  • (3)bbcode_php_printable
  • (16)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete