vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Auto PM (https://vborg.vbsupport.ru/showthread.php?t=197911)

Dman91 12-03-2008 04:22 PM

Auto PM
 
Code:

$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:
PHP Code:

            // Process user.options
            
$message array_merge($messageconvert_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:
PHP Code:

            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>


All times are GMT. The time now is 11:07 AM.

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.01022 seconds
  • Memory Usage 1,744KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (14)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete