PDA

View Full Version : Auto PM


Dman91
12-03-2008, 04:22 PM
$botpermissions['adminpermissions'] = 2;
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
$pmdm->set('fromuserid', '2');
$pmdm->set('fromusername', 'Dman');
$pmdm->set('title', $pmt);
$pmdm->set('message', $pms);
$pmdm->set_recipients($uname, $botpermissions);
$pmdm->set_info('receipt', false);
$pmdm->set_info('savecopy', false);
$pmdm->overridequota = true;
$pmdm->set('dateline', TIMENOW);
$pmdm->save();
I am trying to use this code, to send PM it works but when user choosed "not to receive PM" this code returns error. Any work around ? And all the queries are made after $pmdm->save(); right ?

Dismounted
12-04-2008, 02:49 AM
The "override quota" setting needs to be before the recipients are set, I believe.

Dman91
12-04-2008, 11:08 AM
How to stop it from giving errors ? And all the queries are made after $pmdm->save(); right ?

Dismounted
12-04-2008, 11:38 AM
Again, see my post above - it should address your "PM quota/not enabled" error. If you have any other errors, you have to say so - we aren't mind readers.

Dman91
12-04-2008, 12:16 PM
Edit : I figured out, best way would be to test if user can recieve PM or not - how would I do that ?

Dman91
12-06-2008, 03:18 PM
Bump

Lynne
12-06-2008, 04:31 PM
Did you try what Hanson suggested - putting the override before the set_recipients?

Dman91
12-06-2008, 05:08 PM
I did, but now I want to find out if user has enabled PM or not

sarkar
12-07-2008, 11:27 AM
I would also like an answer to this question?

Dman91
12-08-2008, 04:56 PM
So my question is how do I find out if user has enabled PM (or enabled only for mods etc) ? I have been trying to find those options in the database

Lynne
12-08-2008, 05:11 PM
You will need to look at user.options You will need to find the code that deciphers that field. Or find the code that has deciphered it and find what the new variable is called that you can look at.

Dman91
12-08-2008, 05:26 PM
Unfortunately value of user.options (which is 2048 in my case) doesn't help in deciphering it. Any idea where can i find the code that deciphers it ?

Lynne
12-08-2008, 05:37 PM
Doing a search for "user.options" in the files gives me this in class_profileblock.php:
// Process user.options
$message = array_merge($message, convert_bits_to_array($message['options'], $this->registry->bf_misc_useroptions));So, I'd say that the array was converted into something userful that is now contained in $this->registry->bf_misc_useroptions

Doing a search of "$this->registry->bf_misc_useroptions" in the files turns up a lot more info, like this in class_dm_pm.php:
if (!($user['options'] & $this->registry->bf_misc_useroptions['receivepm']) AND !$this->overridequota)
{
// recipient has private messaging disabled
$this->error('pmrecipturnedoff', $user['username']);
return false;

Just keep finding the terms by following one bit of code to another and just search the terms and I'm sure you'll find exactly what you need. It's all just a matter of search and follow... search and follow...

Dismounted
12-10-2008, 07:42 AM
<a href="https://vborg.vbsupport.ru/showthread.php?t=166940" target="_blank">This might be an interesting read.</a>