PDA

View Full Version : Send PMs (automatically)


Andreas
10 Jun 2005, 05:08
If you want to (automatically) send a PM to a user, you can use the Class vB_Datamanager_PM.
This class makes sure that all values are correct, handles quota for the recipients, notification eMails, etc.

Example



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



If anything goes wrong you can check for errors using


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


This is an erray containing the errors.

If everything is OK


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



This will send a PM to user newuser telling him

Hello.
I am a Bot and would like to give you a warm welcome :)

The message will appear to be coming from User Welcom-Bot (Userid 1234).

$botpermissions must be the permissions for the sending user, but can just be empty.
If you want to send PMs no matter if the PM box of the recipient is full or not:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



If you want, you can set other options as well ($pmdm->set_info(...)):


forward = 1/0 if this is a forwarded PM, Default=0
savecopy = 1/0 to keep a copy if the PM in outbox, Default=0
receipt = 1/0 to request a read-receipt, Default=0
parentpmid = ID of the PM you are responding to (if applicable)


Furthermore you can specify ($pmdm->set(...)):

iconid = ID of the message icon the PM should carry, Default=0
showsignature = 0/1 Whether the signature should be shown or not, Default=0
showsmilie = 0/1 Wheter smilies should be parsed or not, Default=1


For multiple receipients just use user1;user2;useer3.

This How-To is (C) 2005 by KirbyDE and you are not allowed to redistribute it in any way without my explicit consent.

Erwin
10 Jun 2005, 06:37
This is a FANTASTIC tutorial - people can make up a zillion hacks based on this How-To. :)

Logikos
10 Jun 2005, 07:56
KirbyDE, That is great! I just love this.

Finaly the old vB.org is BACK!

Bad Bunny
11 Jun 2005, 04:09
Wow! Lots of good stuff here. I'm so excited about this new release. Thank you so much for the tutorial, as it really does teach you something useful. Thanks!

VBCoder
12 Jun 2005, 07:05
Kirby,

Is there anyway we can get this info for the other classes?

eXtremeTim
13 Jun 2005, 08:17
Kirby,

Is there anyway we can get this info for the other classes?
If I have time tommorrow I will post up one for the new reply class. Since I had a good deal of time working with it today. I now have my talkerbot hack fully using the new reply datamanager.

M1th
14 Jun 2005, 19:52
To send PMs to more than 1 user:


Retrieving usernames:

To get a list of usernames from an array and output in the form of user1;user2;user3:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


replacing xx with usergroupid


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



To output the $pmto_users array into the format user1;user2;user3 you do:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Finally, sending the pm -repeat all the steps mentioned by KirbyDE but replace


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



with:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



[$pmtousernames would output to something like user1;user2;user3;etc]

Link14716
27 Jun 2005, 07:41
The PM data manager seems to completely kill the page when I use this function. It just does a white page and no PM is sent.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


I have since went back to using my old function which got the job done. I'll probably try fixing the version of the function that uses the data manager, but for now...

Andreas
27 Jun 2005, 12:17
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Remove this line and it'll work :)

flup
27 Jun 2005, 19:45
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



What should that line be if it has to be send to the administrator with userid 1 (or just all administrators).

Link14716
27 Jun 2005, 20:38
Remove this line and it'll work :)
I probably would have figured that out if it told me instead of blank paging me. :p

Andreas
27 Jun 2005, 20:41
Suggest @ Jelsoft to call die('Class vB_Datamanager not defined') instead of just exit; :)

Chris M
28 Jun 2005, 00:20
Or just die ;)

Satan

Andreas
28 Jun 2005, 00:26
Hmm, die() without parameters does not produce any output as well, or am I wrong?

Chris M
28 Jun 2005, 09:04
No - I meant that you could suggest to Jelsoft that they could just die:p

They haven't fixed the Beta 3 issue yet :cry:

Satan

dwh
30 Jun 2005, 00:12
I don't understand how to use this? Is this a class built into 3.5? Is this code you would place in one of the files in the include directory? Or you create a new php page with functions?

Would it be possible to explain this hack in detail as if you were speaking to a very dumb person :ninja:

Andreas
30 Jun 2005, 00:22
This is not a Hack, it's Howto ;)
Class vB_Datamanager_PM is a Class that comes with vB 3.5, yes.
You can use code like this wherever you want in your vB Projects/Hacks.

dwh
30 Jun 2005, 01:02
This is not a Hack, it's Howto ;)

Haha, thanks for answering the dumbo :)

Class vB_Datamanager_PM is a Class that comes with vB 3.5, yes.
Whew. I was scared this was an add-on.


You can use code like this wherever you want in your vB Projects/Hacks.

OK, but you need a semicolon here $pmdm->errors
right? Another dummy question, how do you get the array out of there? The "->" is throwing me off.

Andreas
30 Jun 2005, 01:06
For objects (that's an instantiated Class) you must always use ->.

$pmdm->errors was not meant to be used as a single Code-Line, it should just show which property you have to access (for example in an if) to check for errors.

dwh
30 Jun 2005, 01:14
I hate OOP :)
I guess I'll have to get used to it unfortunately.

babolo
06 Jul 2005, 02:57
Does anyone know How I can make this able to send this to new users once they register?

Alan @ CIT
24 Sep 2005, 00:15
Thanks Kirby, another very useful How-to

orban
08 Oct 2005, 01:50
How to parse URLs and email adresses in the pm text?

There must be some parameter :D

-orban

Andreas
08 Oct 2005, 01:55
No. If it contains [email] and [url] codes those will be parsed, if it does not they will (obviously) not be parsed :)

orban
08 Oct 2005, 11:16
Ooooooh!

Because I'm working on my Report to PM (without email notification in any case) plugin...

So I have to change the email template phrase I guess.

Jon@Refresh
26 Oct 2005, 02:49
does anyone know how I can pass an additional variable to $pmdm?

I want to pass a single extra 1 or 0 and I then want to detect this in the $pmdm class and act accordingly.

I know I'll have to modify the code in the $pmdm class, but I can't work out how to pass the extra boolean, and then detect it in the class.

If anyone has any ideas, I'd be very grateful :)

dwh
07 Nov 2005, 23:03
What is "touserarray" used for? It seems redundant. I can remove the data from touserarray in pmtext and it still works fine.

Antivirus
08 Jan 2006, 07:25
trying to use the PM data manager within a plugin at hook location profile_doremovelist. When the script at profile.php runs, everything works out fine, but no PM is sent. I'm stumped :ermm:

here's my code...


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Antivirus
09 Jan 2006, 18:08
I finally figured it out by process of elimination, my results are here (http://www.vbulletin.org/forum/showthread.php?t=104872) if anyone wants to check out the code I used.

Thanks for this howto Andreas, i couldn't have figured this out without this thread. :)

DigitalCrowd
09 Jan 2006, 22:18
Is anybody aware why when you send a pm from a given user to another user through the use of the sendpm code in this thread and found elsewhere, that no email is sent nor does it show a pop-up that you have a PM waiting.

This is kinda worthless in that sense. I have seen others with the same issue, but no work around.

As a follow-up, it did email, but not notification online when sending a regular PM does do that.

Antivirus
11 Jan 2006, 18:40
Is anybody aware why when you send a pm from a given user to another user through the use of the sendpm code in this thread and found elsewhere, that no email is sent nor does it show a pop-up that you have a PM waiting.

I don't have that problem, there has to be a setting in your AdminCP or UserCP that is preventing the PM alert popup for you. For me, everything works just fine, as the PM datamanager has no control over whether or not the email is sent or the popup is shown, those are settings in the AdminCP, UserCP, or vBoptions.

DigitalCrowd
11 Jan 2006, 18:53
Actually, it goes deeper than a pop-up. Even on the "Private Messages" for you under your username in the upper-right hand side of the default templates, it will show "0" even though I will have a new 1. EVEN if someone sends me a PM, it will show 1, when two are really available.

It's as though it thinks I have read it... but I haven't. It does show up as bold though likes its new , the PM area.

Antivirus
11 Jan 2006, 18:58
I'm at a loss, I am not experiencing any of those behaviors on the hack I wrote to send automatic PMs which i learned from reading this HOWTO. All the stuff in the top right, everywhere seems to work as it should on my installations of vb. Maybe it has to do with the location where you're inserting the datamanager code?

JaeTea
14 Jan 2006, 17:44
OK I'm a little confused with PMing multiple users.

Suppose I have two textfields, user1 and user2.

All I want to do is combine those two values into the format user1;user2 and input that into the "$pmdm->set_recipients" line so I can send the PM to the two users specified.

Developer
14 Jan 2006, 18:46
i am working on a new hack "Auto PM in members birthday"
i will use it as a cron jop but i have a proplem in recipient i can't make it sends the message to any member

CrazyShooter
23 Jan 2006, 23:30
I am confussed, how do i make it so that a new user will get a private message automaticly sent by me saying Welcome?

bulbasnore
01 Feb 2006, 19:48
I'm interested in some hints, or pointers to other tutorials, on how I might use this to PM a user when a mod delete's their message. I'd like to include the reason they list in the delete reason blank.

noonespecial
21 May 2006, 20:23
This would be great to use as a "poke" sort of feature like facebook.com has, I'm not sure exactly how to do that at all - but it would be awesome to try ...

Logikos
22 May 2006, 05:18
What is the "poke" feature? Never heard of it.

Alan @ CIT
22 May 2006, 07:45
I'm interested in some hints, or pointers to other tutorials, on how I might use this to PM a user when a mod delete's their message. I'd like to include the reason they list in the delete reason blank.

Take a look at the code for my "Moderation Auto-PM" hack - this should get you started with sending PM's when a post is deleted.

Thanks,
Alan.

Antivirus
26 Jul 2006, 17:00
Does anyone know if there's a setting which can be used within ($pmdm->set(...)) for whether or not to parse html? In other words, if the text sent in the PM is allowed to use html?

fly
30 Sep 2006, 15:05
Was something changed on 3.6? This code no longer works:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I haven't changed any of the code from 3.5 since the upgrade, so something in there no longer works. Any idea what it is?

Okay, I got it working, but there is no popup for the user about a PM. Any ideas?

Cebby
30 Sep 2006, 22:18
This seems like a good place to ask ;)

I'm creating a link in a vB powered page (template) for a user to send a PM to me on a specific subject (just like you can do with EM very easily). I want it to open the PM, address it, and fill in the title of the PM, then wait for the user to enter their message.

Can this be done in 3.6.1?

DigitalCrowd
07 Oct 2006, 01:23
I have to do this to get private messages to update correctly in most cases. In a few specific cases, I don't have too. But, don't remember off the top my head which one.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



That will do the trick everytime. ;)

HPIA
01 Nov 2006, 06:01
Where does this go exactly XD?

CyberRanger
08 Nov 2006, 17:13
If you want to send PMs no matter if the PM box of the recipient is full or not:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Thx for the wonderful tutorial. I've used your guide to develop an add-on to one of my products. (http://www.vbulletin.org/forum/showthread.php?t=130536)

The only item that I can't get working is overriding the mailbox full restriction. I've used the code above but setting adminpermissions to 2 doesn't seem to work. In class_dm_pm.php, $overridequota = false seems to need to be set to "true" but I can't figure out how to do that.

If you have a few minutes, I'd really appreciate help in figuring out how to set the variables so that the user will receive the PM even if his mailbox is full and he receives PMs only from buddies and sender is not on the list and not board staff.

I'm pretty sure that can be achieved by setting $overridequota = true, just can't figure out how to do that.

In class_dm_pm.php, line 80:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



while starting at line 370:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



But I don't see anyway to set $overridequota without hacking class_dm_pm.php.

Thx!

Acido
09 Nov 2006, 17:31
What's the trick to Automatically parse links in text ?

mrpaint
11 Nov 2006, 22:20
What's the trick to Automatically parse links in text ?
Just use BBCode such as [url]


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



That will do the trick everytime.[/quote]

Any new ideas?

mferguson
20 Nov 2006, 18:15
The only item that I can't get working is overriding the mailbox full restriction. I've used the code above but setting adminpermissions to 2 doesn't seem to work. In class_dm_pm.php, $overridequota = false seems to need to be set to "true" but I can't figure out how to do that.

I had the same issue. What I found by searching through all the vB code is a couple of places where overridequota was referenced. All that is required to set this to send the PM even if the recipient's mailbox is full is to:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Here is how my code looks with this:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Hope this helps everyone that was running into similar problems.

Mark

When testing my auto send pm's code I kept seeing users that had pmpopup (popup-based pm notification) not being updated when I sent my auto pm.

If a user has pmpopup notification on this column should show as "1" in the user table. If they receive a new message and haven't read it yet it should show as "2" in the user table. The two denotes that there is an unread popup.

In the case where I was sending a message to multiple recipients I noticed that only the last of the recipients that also had pmpopup notification was having the pmpopup column updated to "2" while other's weren't.

In debuggint this problem I found that in the forums/includes/class_dm_pm.php file that line 557:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



is reinitializing the array and therefore causes any previous userids that have pmpopup enabled to be lost (since its within a foreach loop processing all the users)

To resolve this I've commented the line out for now and also filed a bug report with vBulletin to get it resolved in a future release. I found this is 3.6.1 and also in 3.6.3.

Hope this helps some others that found problems in getting this mod working as expected.

Mark

Blaine0002
14 Dec 2006, 20:38
Would i need to change anything to stick this into a cron?
If so what would i change

If i dont need to change anything is it because im using 3.6.0 that its not working?

mferguson
14 Dec 2006, 20:43
Are you wanting to bulk email members based on a cron? If so the only thing I believe you need to do would be to figure out what you needed to populate when the cron is run (ie - subject, body, etc.)

Mark

Blaine0002
14 Dec 2006, 20:54
no, only want it to send 2 pms, but its not sending any, and the cron IS being run correctly.

mferguson
14 Dec 2006, 21:16
I guess I'm confused as to why you are doing this with a cron. If you can provide some background it will give me a better idea of how it might be done.

As to the cron itself. How are you verifying that it is being run correctly? Is there some type of output being generated?

Thanks

Mark

Blaine0002
15 Dec 2006, 02:05
in my auction modification, a cron runs every 10 minutes which closes auctions and notifies buyer and seller of who won.

paul41598
20 Dec 2006, 19:27
Um I have the below code in a cron job, and when it runs Im getting this error:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------






Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Whats wrong here? I think it worked before now all of a sudden doesnt... (I think) :cross-eyed:

jwocky
20 Dec 2006, 23:06
Um I have the below code in a cron job, and when it runs Im getting this error:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------






Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Whats wrong here? I think it worked before now all of a sudden doesnt... (I think) :cross-eyed:

Wow, i'm having the identical error message which just started today as well, I wonder whats going on here... and I mean identical Is there a way to get the script to echo the error? return $pmdm->errors; ? I have that in my cron script, but when i run it in the task manager i get no text echoed, maybee another way so that we can diagnose this problem

Blaine0002
20 Dec 2006, 23:41
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



When i did a cron i actually made a seperate function and ran the function from the cron.

jwocky
20 Dec 2006, 23:44
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



When i did a cron i actually made a seperate function and ran the function from the cron.

That just prints out the word "Array" .. dont know how to parse that pmdm->errors to give us some valuable data on diagnosing the problem

paul41598
21 Dec 2006, 00:27
actually if I take out the PM datamanager code temporarily...and replace with this:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I get CMUrickCMUrick;Pepsico

Its printing out CMUrick twice and I have no idea why. But its working kinda...

jwocky: You need the code in this post I think to grab names and put em in an array, then you will get a different output in your tests.

jwocky
21 Dec 2006, 01:43
actually if I take out the PM datamanager code temporarily...and replace with this:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I get CMUrickCMUrick;Pepsico

Its printing out CMUrick twice and I have no idea why. But its working kinda...

jwocky: You need the code in this post I think to grab names and put em in an array, then you will get a different output in your tests.


Ok, i imploded the array $pmdm->errors in the same way you did above and got it to spit out the error code, turns out in my case, the user set to recieve the PM had his inbox full! argh.

paul41598
21 Dec 2006, 01:49
least urs might be working..mine keeps sending multiple PM's to the same person. argh

jwocky
21 Dec 2006, 01:54
least urs might be working..mine keeps sending multiple PM's to the same person. argh

If its doubling up the name like that without the semicolon it shouldnt be sending multiple pms? try doing the same thing I did (put the pmdm->errors into the implode and then echo that variable and see what the exact error is thats being stored ?

paul41598
21 Dec 2006, 02:07
Ok here is my code in my cron...stripped down to show the basic idea.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



WHen I run my CRON job manually, it echo's out this: (keeping in mind there are 2 users who have a post_groan_time greater than 0...



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I got it, Im an idiot

sp00fer
21 Dec 2006, 20:24
i get an mySQL sytax error if i use this to send a PM to a user with an apostrophe in his name........any help?

Edit: Manually Escaping the apostrophe also doesnt work (generates a vbulletin error: cant find user)

nevermind, its not a problem after all :D

jwocky
12 Feb 2007, 05:12
Any ideas how to override a full PM box in vb 3.6? the $pmdm->overridequota = true; doesn't seem to be working at all :(

Antivirus
18 Feb 2007, 00:59
$pmdm->overridequota = true; works fine for me. Although I think it needs to be right after you initialize the class like this:
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
$pmdm->overridequota = true;

You might also need to set $botpermissions in set recipients like this:
$pmdm->set_recipients($recipient, $botpermissions);

cashpath
07 Mar 2007, 17:50
$pmdm->set_recipients($recipient, $botpermissions);

Quick question.. is there a way to send the PM to a recipient by userid instead of by username???

Thanks.

fly
07 Mar 2007, 18:15
Quick question.. is there a way to send the PM to a recipient by userid instead of by username???

Thanks.

Can't you just get the name from the id? Why do you have one but not the other?

cashpath
07 Mar 2007, 18:23
Well.. I have stored the userid into another custom table..and it is not the userid that is currently accessing the page. I didn't store the username..

If there is no way to send to the userid using the functions then I guess I can always just store the username also... Good point.

fly
07 Mar 2007, 18:37
Well.. I have stored the userid into another custom table..and it is not the userid that is currently accessing the page. I didn't store the username..

If there is no way to send to the userid using the functions then I guess I can always just store the username also... Good point.

You could always just do a query to get the name. There is likely a better solution that is beyond me though...

cashpath
07 Mar 2007, 18:49
Yeah I didn't want to run another query it's a relatively small table.. but I just wasn't thinking and storing the username also is the smart move... thanks for waking me up :)

Deriel
13 Mar 2007, 18:46
How do I send a PM to a user A (normal) and the same PM to user B (with BCC)? user B shall receive the same PM from A but user A should'nt know that user B got the PM too.

CyberRanger
13 Mar 2007, 19:07
How do I send a PM to a user A (normal) and the same PM to user B (with BCC)? user B shall receive the same PM from A but user A should'nt know that user B got the PM too.

untested but should work: set_recipients($recipientlist, $botpermissions, $type = 'bcc')

xman_79
28 Mar 2007, 19:00
Thank you for your useful and explicite answer .

I made a modul in wich a member can add a text.
I want this member to receive a pm in case I erase his text.
I have accomplished a modul but I want to know if the code is correct .



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Thank you .

budlight
30 Mar 2007, 22:53
Thank you for your useful and explicite answer .

I made a modul in wich a member can add a text.
I want this member to receive a pm in case I erase his text.
I have accomplished a modul but I want to know if the code is correct .



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Thank you .

This looks like a horrible idea, as anyone could just enumerate through the textid's and delete them all.

xman_79
01 Apr 2007, 02:27
This looks like a horrible idea, as anyone could just enumerate through the textid's and delete them all.


This isn't the entire code , I wrote just the part that I was more intrested in .
I am interested in the idea not in the code itself .

Thanks .

Till
18 Apr 2007, 15:19
I am using this snippet on a non-VB page. Beforehand I am including the global.html and so on - as described in various "login from non-vb page" threads/hacks.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



$to is set to a valid username, however i get the following error right with the "set_recipients" part.


Fatal error: Call to undefined function: query_first_slave() in /user/public_html/community/includes/functions.html on line 1154


Anyone have an idea? I did a var_dump(get_class_methods($vbulletin->db)); right beforeit uses the query_first_slave and it shows the query_first_slave method. My PHP is 4.4.x - so do I need to update my vb? We are still on 3.6.4 (only on the development server).

Factory Ten
19 Apr 2007, 19:56
Is there a way I can use this to automatically PM someone when they get an infraction?

CyberRanger
19 Apr 2007, 20:05
Is there a way I can use this to automatically PM someone when they get an infraction?
:confused: That's already an option in the infraction system.

Punky Guy
04 May 2007, 15:28
Is there a way I can call this from a link or button? Some hook I could use?

jwocky
20 Jun 2007, 00:57
Any new/novel solutions to the problem of PMs not updating in their count #? I dont want to do the digitalcrowd method of manually incrementing the # in teh database because it seems to sometimes update correctly and not other times.

Is there a way to tell vb to reasses the PM count using a built in function?

Adib
20 Jun 2007, 19:21
Any new/novel solutions to the problem of PMs not updating in their count #? I dont want to do the digitalcrowd method of manually incrementing the # in teh database because it seems to sometimes update correctly and not other times.

Is there a way to tell vb to reasses the PM count using a built in function?

Yes, I'd like to know this as well. Doesn't vb have a built in function to do this? I'm very hesitant of making a database call to vb's database if I don't have to.

nuk3
28 Jun 2007, 04:45
Yes, I'd like to know this as well. Doesn't vb have a built in function to do this? I'm very hesitant of making a database call to vb's database if I don't have to.


In private.php:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Give that a whirl.

workplaybiz
01 Sep 2007, 22:15
How Can I Send A Private Message To Users As Soon As They Make Their 10th Post?

rwoscott
07 Feb 2008, 22:58
Is there a way I can call this from a link or button? Some hook I could use?
I'd like to know how to do this as well.

Anyone got any help on this?

Antivirus
26 Feb 2008, 23:27
FYI, there seems to be a new function within the PM datamanager in version 3.7.0, which is needed for sending automatic PMs (such as in the welcome pm)

$pmdm->set_info('is_automated', true);

xxclixxx
08 Mar 2008, 21:09
I am receiving an error that the user has PMs disabled, when the user doesn't. Any ideas? I'm attempting to send a PM to the main administrator account.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



($userid and $username are properly filled during the test. It works if I send to the test account, but not to the admin account.)

xxclixxx
14 Mar 2008, 14:00
I found mferguson's modification fixed the problem I was having:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I think it was the overridequota that did it.

Axor
28 Mar 2008, 20:46
Hello,

how does it works to send html in the private message?
i want to send a javascript to open a popup window with a picture.

the pm will be sent automatically

thx 4 help

Jase2
15 Jul 2008, 22:15
Hi Andreas,

The following bit:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



How would I go about changing this to a phrase, so that users can have the message however they like. Is it possible?

Thanks.

-- Jason

Rich
18 Jul 2008, 15:51
Hi Andreas,

The following bit:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



How would I go about changing this to a phrase, so that users can have the message however they like. Is it possible?

Thanks.

-- Jason

Thats actually pretty easy Jason. You need to set 2 things.

First you need this BEFORE the message is called to be sent:

$message = $vbphrase[your_phrase];

Then change the line you have posted above to read:

$pmdm->set('message', $message);

squishi
03 Sep 2008, 22:40
Does this work with 3.7.3?
And if so, wkhat file do I need to include in the php file?

veenuisthebest
09 Sep 2008, 16:03
Does this work with 3.7.3?
And if so, wkhat file do I need to include in the php file?
yes it would work in all versions of vb

no file to include.

Excalibur82
07 Apr 2009, 06:53
Since my code deals with PM's I need to exclude myself from receiving a PM as I am the one making the new comment.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Now what I am trying to do is this (I know this won't work but an example of what I need:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I couldn't find anything to exclude my id, does anyone know how to do this?

Thanks

mferguson
07 Apr 2009, 17:58
You should be able to exclude yourself using the following query given that userid is a column in the threadcomment table.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Excalibur82
07 Apr 2009, 19:52
Thank you very much, thats what I needed.

Had to change it:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Works like a charm.

mferguson
07 Apr 2009, 22:22
Glad to help!

bpr
03 May 2010, 01:58
Is it possible to transfer it for the vb 4.0. x ?

steveheinsch
13 May 2010, 21:22
I am sending to a lot of recipients at once. Its in a loop sending to 20 recipients at a time (user1;user2;etc)

Occasionally Ill get the following error when checking $pmdm->errors:

XXXX has chosen not to receive private messages or may not be allowed to receive private messages. Therefore you may not send your message to him/her.

If you are trying to send this message to multiple recipients, remove XXXX from the recipient list and send the message again.

How does one check to see if someone is allowed to receive a PM before its sent so I can exclude them from the recipients?

I am using $botpermissions['adminpermissions'] = 2; to override if their mailbox is full, but don't want to send a PM to people who aren't allowed by way of permissions to receive them.

Can this be checked in the query I am using to select names from the user table? Or is there code that can be used to check to see if the user is able to receive PM's?

I appreciate any insight.
Thanks,
Steve