vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Send PMs (automatically) (https://vborg.vbsupport.ru/showthread.php?t=82786)

jwocky 06-19-2007 10:57 PM

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 06-20-2007 05:21 PM

Quote:

Originally Posted by jwocky (Post 1272094)
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 06-28-2007 02:45 AM

Quote:

Originally Posted by Adib (Post 1272600)
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:

// ###################### Start pm update counters #######################
// update the pm counters for $vbulletin->userinfo
function build_pm_counters()
{
        global $vbulletin;

        $pmcount = $vbulletin->db->query_first("
                SELECT
                        COUNT(pmid) AS pmtotal,
                        SUM(IF(messageread = 0 AND folderid >= 0, 1, 0)) AS pmunread
                FROM " . TABLE_PREFIX . "pm AS pm
                WHERE pm.userid = " . $vbulletin->userinfo['userid'] . "
        ");

        $pmcount['pmtotal'] = intval($pmcount['pmtotal']);
        $pmcount['pmunread'] = intval($pmcount['pmunread']);

        if ($vbulletin->userinfo['pmtotal'] != $pmcount['pmtotal'] OR $vbulletin->userinfo['pmunread'] != $pmcount['pmunread'])
        {
                // init user data manager
                $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
                $userdata->set_existing($vbulletin->userinfo);
                $userdata->set('pmtotal', $pmcount['pmtotal']);
                $userdata->set('pmunread', $pmcount['pmunread']);
                $userdata->save();
        }
}


Give that a whirl.

workplaybiz 09-01-2007 08:15 PM

How Can I Send A Private Message To Users As Soon As They Make Their 10th Post?

rwoscott 02-07-2008 08:58 PM

Quote:

Originally Posted by Punky Guy (Post 1241322)
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 02-26-2008 09:27 PM

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 03-08-2008 07:09 PM

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:

$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
$pmdm->set_info('savecopy', 1);
$pmdm->set('fromuserid', $userid);
$pmdm->set('fromusername', $username);
$pmdm->set('title', 'this is a title');
$pmdm->set('message', 'this is a message');
$pmdm->set_recipients('xxclixxx', $permissions);
$pmdm->set('dateline', TIMENOW);

$pmdm->pre_save();

// process errors if there are any
$errors = $pmdm->errors;

($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 03-14-2008 12:00 PM

I found mferguson's modification fixed the problem I was having:

PHP Code:

$pmdm->set_info('receipt'false);
$pmdm->set_info('savecopy'false);
$pmdm->overridequota true

I think it was the overridequota that did it.

Axor 03-28-2008 06:46 PM

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 07-15-2008 08:15 PM

Hi Andreas,

The following bit:

PHP Code:

$pmdm->set('message'"Hello\nI am a Bot and would like to give you a warm welcome :)"); 

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


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

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01939 seconds
  • Memory Usage 1,746KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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