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)

cashpath 03-07-2007 04:49 PM

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 03-13-2007 04:46 PM

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 03-13-2007 05:07 PM

Quote:

Originally Posted by Deriel (Post 1202644)
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 03-28-2007 05:00 PM

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:

//The link is : script.php?do=delete&p=$row['text_id']

if(isset($_GET['p']) AND is_numeric($_GET['p']))
{
        $me = $db->query_read("SELECT text_title,text_uid,text_user FROM " . TABLE_PREFIX . "table WHERE text_id='{$_GET['p']}'");
        $me_s = $db->fetch_array($me);
        $txtuid        = $me_s['text_uid'];
        $username        = $me_s['text_user'];
        $title                = $me_s['text_title'];
               
        $pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
        $pmdm->set('fromuserid', $txtuid);
        $pmdm->set('fromusername', $username);
        $pmdm->set('title', 'Information');
        $pmdm->set('message', "I delete your text : $title .......");
        $pmdm->set_recipients($username, $botpermissions);
        $pmdm->set('dateline', TIMENOW);
        $pmdm->errors;
        $pmdm->save();
       
        $db->query_write("DELETE FROM " . TABLE_PREFIX . "table WHERE text_id='{$_GET['p']}'");
        define('CP_REDIRECT', "script.php?do=show");
        print_stop_message('text_deleted');
        exit;
}

Thank you .

budlight 03-30-2007 08:53 PM

Quote:

Originally Posted by xman_79 (Post 1214586)
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:

//The link is : script.php?do=delete&p=$row['text_id']

if(isset($_GET['p']) AND is_numeric($_GET['p']))
{
        $me = $db->query_read("SELECT text_title,text_uid,text_user FROM " . TABLE_PREFIX . "table WHERE text_id='{$_GET['p']}'");
        $me_s = $db->fetch_array($me);
        $txtuid        = $me_s['text_uid'];
        $username        = $me_s['text_user'];
        $title                = $me_s['text_title'];
               
        $pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
        $pmdm->set('fromuserid', $txtuid);
        $pmdm->set('fromusername', $username);
        $pmdm->set('title', 'Information');
        $pmdm->set('message', "I delete your text : $title .......");
        $pmdm->set_recipients($username, $botpermissions);
        $pmdm->set('dateline', TIMENOW);
        $pmdm->errors;
        $pmdm->save();
       
        $db->query_write("DELETE FROM " . TABLE_PREFIX . "table WHERE text_id='{$_GET['p']}'");
        define('CP_REDIRECT', "script.php?do=show");
        print_stop_message('text_deleted');
        exit;
}

Thank you .

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

xman_79 04-01-2007 12:27 AM

Quote:

Originally Posted by budlight (Post 1216431)
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 04-18-2007 01:19 PM

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:

$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
$pmdm->set('fromuserid', 5);
$pmdm->set('fromusername', 'Foo');
$pmdm->set('title', sprintf('Einladung %s', $name));
$pmdm->set('message', $message);
$pmdm->set_recipients($to, $botpermissions);
$pmdm->set('dateline', TIMENOW);
//var_dump($pmdm->errors);

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

Quote:

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 04-19-2007 05:56 PM

Is there a way I can use this to automatically PM someone when they get an infraction?

CyberRanger 04-19-2007 06:05 PM

Quote:

Originally Posted by Factory Ten (Post 1231381)
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 05-04-2007 01:28 PM

Is there a way I can call this from a link or button? Some hook I could use?


All times are GMT. The time now is 11: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.03008 seconds
  • Memory Usage 1,747KB
  • 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
  • (3)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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