Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Yet Another Mass Private Message System 1.0.1 Details »»
Yet Another Mass Private Message System 1.0.1
Version: 1.0.1, by mtha mtha is offline
Developer Last Online: May 2016 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 3.6.5 Rating:
Released: 03-09-2007 Last Update: 03-10-2007 Installs: 869
Uses Plugins
Additional Files  
No support by the author.

Yet Another Mass Private Message System

This mod has been nominated for mod of the month April 2007. Please go to the poll and vote. Thanks

Hack Version: 1.0.1.070310
Compatible vB version: 3.6.x
Support: https://vborg.vbsupport.ru/showthread.php?t=141622

NOTE:
This hack is not related to, nor using Zero Tolerance's "Admin Mass PM Members" hack.
Although this is a new hack, I still would say thanks to insanctus, Oblivion Knight and Zero Tolerance for their idea and hacks on sending mass PM from admincp. I also want to thank the members who need this hack badly, and support it.

DESCRIPTION:

This system allows admins to send mass private message to members from AdminCP
Some options:
- Detail user search condition, so you can send PM to diffent usergroups, that satisfy different condition
- Send "Test" Private Message,
- Allow/disable smilies
- Override "Receive Private Messages = NO" option?
- set number of PMs to send at once
- Use different user as Sender (by userid)

CHANGES/MODIFICATION:

- Query: 0
- Files to add: 2
- Product to import: 1

INSTALL:

1. Upload all files in UPLOAD folder to your server
2. Import XML product (product-hn_masspm.xml) using vBulletin product import tool.
ACP -> Plugin System -> Manage Products -> Add/Import Product
3. Refresh menu panel to display "Send PM to Users" link in "Users" section.

UPGRADE:
1. Upload all files in UPLOAD folder to your server
2. Import XML product (product-hn_masspm.xml) using vBulletin product import tool with Override option checked.

SCREENSHOT:
Included

HISTORY:

v. 1.0.0 (3.10.2007) Initial release
v. 1.0.1 (3.10.2007) Fix some bugs, add more options when sending PMs

Download Now

File Type: zip YetAnotherMassPMSystem1.0.1.zip (122.7 KB, 7722 views)

Screenshots

File Type: jpg hn_masspm_menu.jpg (17.7 KB, 0 views)
File Type: jpg hn_masspm_sendingpms.jpg (21.0 KB, 0 views)
File Type: jpg hn_masspm_mainscreen.jpg (71.5 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #212  
Old 06-06-2008, 04:21 PM
jdebler jdebler is offline
 
Join Date: Sep 2002
Location: Detroit
Posts: 75
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by GPTB View Post
I have this installed on vB 3.7.1 but even when I ask it not to, the script appears to be sending this to all members (including those that have declined to receive Admin e-mails) - this is a serious problem.
I agree, it is a rather serious problem. It got me in trouble with a lot of my members who specified that they didn't want to be contacted by admins that way but did anyway. I explained this problem in post #109 nearly a year ago. I offered to pay someone to fix it in post #111, gave results of my testing in post #116, reminded folks that it doesn't work in post #206. I eventually had to start looking for an alternate way to mass PM my members, or at least only the ones who want them.

I appreciate any effort by programmers here because they can do what I cannot, but if it isn't going to be supported by the author then it shouldn't say that it will be in the product information. That way, there won't be any misunderstandings.
Reply With Quote
  #213  
Old 06-10-2008, 03:46 PM
GPTB GPTB is offline
 
Join Date: Mar 2007
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jdebler View Post
I agree, it is a rather serious problem. It got me in trouble with a lot of my members who specified that they didn't want to be contacted by admins that way but did anyway. I explained this problem in post #109 nearly a year ago. I offered to pay someone to fix it in post #111, gave results of my testing in post #116, reminded folks that it doesn't work in post #206. I eventually had to start looking for an alternate way to mass PM my members, or at least only the ones who want them.

I appreciate any effort by programmers here because they can do what I cannot, but if it isn't going to be supported by the author then it shouldn't say that it will be in the product information. That way, there won't be any misunderstandings.
I agree.

If someone is able and willing to update this and fix this huge bug I know I would really appreciate it.
Reply With Quote
  #214  
Old 06-15-2008, 05:25 PM
toonysnn toonysnn is offline
 
Join Date: Sep 2006
Location: Texas
Posts: 511
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've applied a fix and sent it to GPTB in PM. If he would like to place it here, it's fine with me.

The fix has been tested and proved working on vBulletin 3.7.1 Patch Level 1.
Reply With Quote
  #215  
Old 06-15-2008, 11:57 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would also be interested in that fix.
Reply With Quote
  #216  
Old 06-16-2008, 04:06 PM
GPTB GPTB is offline
 
Join Date: Mar 2007
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm happy to place it here for the benefit of the community... I did pay for this fix so if anyone feels an urge to contribute to the cost of it feel free to send me a PM.

I've tested it and it seems to work

Simply replace hn_masspm.php with:

Code:
<?php

/*======================================================================*\
|| #################################################################### ||
|| # Yet Another Mass Private Message System v1.0.1 by mtha           # ||
|| # ---------------------------------------------------------------- # ||
|| # For use with vBulletin Version 3.6.x                             # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| # Discussion and support available at                              # ||
|| # https://vborg.vbsupport.ru/showthread.php?t=141622           # ||
|| #################################################################### ||
\*======================================================================*/

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('CVS_REVISION', '$RCSfile: hn_masspm.php,v 1.0.1 by mtha - $Revision: 070310 $');

// #################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array('user', 'cpuser', 'messaging', 'cprofilefield','pm');
$specialtemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');
require_once(DIR . '/includes/adminfunctions_profilefield.php');
require_once(DIR . '/includes/adminfunctions_user.php');

// ############################# LOG ACTION ###############################
log_admin_action();

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

print_cp_header($vbphrase['hn_masspm_pm_manager']);

 // ##################### Start ##########################
if (empty($_REQUEST['do']))
{
    $_REQUEST['do'] = 'start';
}

// ###################### Send Mass PM ########################
if ($_REQUEST['do'] == 'dosendpm')
{
    $vbulletin->input->clean_array_gpc('p', array(
        'user'              => TYPE_ARRAY,
        'profile'           => TYPE_ARRAY,
        'serializeduser'    => TYPE_STR,
        'serializedprofile' => TYPE_STR,
        'septext'           => TYPE_NOTRIM,
        'perpage'           => TYPE_UINT,
        'startat'           => TYPE_UINT,
        'test'              => TYPE_BOOL,
        'receipt'                        => TYPE_BOOL,
        'savecopy'                    => TYPE_BOOL,
        'allowsmilie'                => TYPE_BOOL,
        'from'              => TYPE_STR,
        'fromuserid'                => TYPE_UINT,
        'subject'           => TYPE_STR,
        'message'           => TYPE_STR,
        'overridereceivepm'    => TYPE_BOOL,
    ));

//    require_once(DIR . '/includes/functions_misc.php');

    $message = $vbulletin->GPC['message'];
    $subject = $vbulletin->GPC['subject'];

    if (trim($subject) == '' || trim($message) == '')
    {
        print_stop_message('nosubject');
    }

    if ($vbulletin->GPC['fromuserid'])
    {
        $fromuser = $db->query_first("
                    SELECT userid,username
                    FROM " . TABLE_PREFIX . "user AS user
                    WHERE user.userid = " . $vbulletin->GPC['fromuserid']
                    );
    }

    if (!$fromuser)
    {
        $fromuser['userid'] = $vbulletin->userinfo['userid'];
        $fromuser['username'] = $vbulletin->userinfo['username'];
    }

    if (!empty($vbulletin->GPC['serializeduser']))
    {
        $vbulletin->GPC['user'] = @unserialize($vbulletin->GPC['serializeduser']);
        $vbulletin->GPC['profile'] = @unserialize($vbulletin->GPC['serializedprofile']);
    }

    $condition = fetch_user_search_sql($vbulletin->GPC['user'], $vbulletin->GPC['profile']);
    if (!$condition)
    {
        $condition = ' 1=1 ';
    }

    $finalcondition = "
        $condition "
         . iif($vbulletin->GPC['overridereceivepm'], "", " AND (options & " . $vbulletin->bf_misc_useroptions['receivepm'] . ")") . "
        AND user.email <> ''
        " . iif(!$vbulletin->GPC['user']['adminemail'], " AND (options & " . $vbulletin->bf_misc_useroptions['adminemail'] . ")");

    if (empty($vbulletin->GPC['perpage']))
    {
        $vbulletin->GPC['perpage'] = 500;
    }

    @set_time_limit(0);

    $counter = $db->query_first("
            SELECT COUNT(*) AS total
            FROM " . TABLE_PREFIX . "user AS user
            LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (userfield.userid = user.userid)
            LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)
            WHERE $finalcondition
            ");

    if ($counter['total'] == 0)
    {
        print_stop_message('no_users_matched_your_query');
    }
    else
    {
        $users = $db->query_read("
                SELECT user.userid, user.usergroupid, user.username, user.email, user.joindate,
                    useractivation.activationid
                FROM " . TABLE_PREFIX . "user AS user
                LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (userfield.userid = user.userid)
                LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)
                LEFT JOIN " . TABLE_PREFIX . "useractivation AS useractivation ON (useractivation.userid = user.userid AND useractivation.type = 0)
                WHERE $finalcondition
                ORDER BY userid
                LIMIT " . $vbulletin->GPC['startat'] . ", " . $vbulletin->GPC['perpage'] . "
                ");
        if ($db->num_rows($users))
        {
            $page = $vbulletin->GPC['startat'] / $vbulletin->GPC['perpage'] + 1;
            $totalpages = ceil($counter['total'] / $vbulletin->GPC['perpage']);
            echo '<p><b>' . $vbphrase['hn_masspm_PMing'] . ' <br />' . construct_phrase($vbphrase['showing_users_x_to_y_of_z'], vb_number_format($vbulletin->GPC['startat'] + 1), iif ($vbulletin->GPC['startat'] + $vbulletin->GPC['perpage'] > $counter['total'], vb_number_format($counter['total']), vb_number_format($vbulletin->GPC['startat'] + $vbulletin->GPC['perpage'])), vb_number_format($counter['total'])) . '</b></p>';
            vbflush();
    
            $recipients = array();
            while ($user = $db->fetch_array($users))
            {
                    $recipients[] = unhtmlspecialchars($user['username']);
//                    $recipients[] = html_entity_decode($user['username']);
            }
    
            if (empty($recipients))
            {
                $pmusers = '';
            }
            else
            {
                $pmusers = implode(' ; ', $recipients);
            }

            echo "\n $pmusers \n";
    
            // create the DM to do error checking and insert the new PM
            $botpermissions['adminpermissions'] = 2;

            $pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_SILENT);
            $pmdm->overridequota = true;
            $pmdm->set('fromuserid', $fromuser['userid']);
            $pmdm->set('fromusername', $fromuser['username']);
            $pmdm->set_info('receipt', $vbulletin->GPC['receipt']);            //false    
            $pmdm->set_info('savecopy', $vbulletin->GPC['savecopy']);     //false
            $pmdm->set('allowsmilie', $vbulletin->GPC['allowsmilie']);    //true
            $pmdm->set('title', $subject);
            $pmdm->set('message', $message);
            $pmdm->set_recipients($pmusers, $botpermissions);
            $pmdm->set('dateline', TIMENOW);
    
            $pmdm->pre_save();
            if (empty($pmdm->errors))
            {
                if (!$vbulletin->GPC['test'])
                {
                    $pmdm->save();
                    echo "<hr><b>$vbphrase[hn_masspm_noerror_sent]</b><hr>";
                }
                else
                {
                    echo "<hr><b>$vbphrase[hn_masspm_noerror_test]</b><hr>";
                }
            }
            else
            {
                echo "<hr><b><font color=red>$vbphrase[hn_masspm_error_nopmsent]:</font></b><pre>";
                print_r($pmdm->errors);
                echo "</pre><hr> ";
            }
            unset($pmdm);
            vbflush();
    
            $_REQUEST['do'] = 'donext';
        }
        else
        {
            define('CP_REDIRECT', 'hn_masspm.php?' . $vbulletin->session->vars['sessionurl']);
            print_stop_message('hn_masspm_sent_successfully');
        }
    }
}


// *************************** Link to next page of PMs to send **********************
if ($_REQUEST['do'] == 'donext')
{
    $vbulletin->GPC['startat'] += $vbulletin->GPC['perpage'];

    print_form_header('hn_masspm', 'dosendpm');
    construct_hidden_code('test', $vbulletin->GPC['test']);
//    construct_hidden_code( 'receipt', $vbulletin->GPC['receipt']);
//    construct_hidden_code( 'savecopy', $vbulletin->GPC['savecopy']);
    construct_hidden_code('allowsmilie', $vbulletin->GPC['allowsmilie']);

    construct_hidden_code('serializeduser', serialize($vbulletin->GPC['user']));
    construct_hidden_code('serializedprofile', serialize($vbulletin->GPC['profile']));
    construct_hidden_code('fromuserid', $vbulletin->GPC['fromuserid']);
    construct_hidden_code('subject', $vbulletin->GPC['subject']);
    construct_hidden_code('message', $vbulletin->GPC['message']);
    construct_hidden_code('startat', $vbulletin->GPC['startat']);
    construct_hidden_code('perpage', $vbulletin->GPC['perpage']);
    construct_hidden_code('overridereceivepm', $vbulletin->GPC['overridereceivepm']);
    print_submit_row($vbphrase['next_page'], 0);
//    print_cp_redirect('',2);
}

// ###################### Send PM ########################
if ($_REQUEST['do'] == 'start')
{    
?>
<script type="text/javascript">
function check_all_usergroups(formobj, toggle_status)
{
    for (var i = 0; i < formobj.elements.length; i++)
    {
        var elm = formobj.elements[i];
        if (elm.type == "checkbox" && elm.name == 'user[usergroupid][]')
        {
            elm.checked = toggle_status;
        }
    }
}
</script>
<?php
    print_form_header('hn_masspm', 'dosendpm');
    print_table_header($vbphrase['hn_masspm_pm_manager']);
    print_yes_no_row($vbphrase['hn_masspm_test_pm_only'], 'test', 0);

//    print_yes_no_row($vbphrase['request_receipt_for_message'], 'receipt', 0);                // Doesnt work for BCC
//    print_yes_no_row($vbphrase['save_copy_in_sent_items_folder'], 'savecopy', 0);        // NOT RECOMMENDED 
    print_yes_no_row($vbphrase['allow_smilies'], 'allowsmilie', 1);

    print_yes_no_row($vbphrase['hn_masspm_overridereceivepm'],'overridereceivepm', 0);
    print_input_row($vbphrase['hn_masspm_pm_to_send_at_once'], 'perpage', 500);
    print_input_row($vbphrase['from'] . " " . $vbphrase['userid'], 'fromuserid', $vbulletin->userinfo['userid']);
    print_input_row($vbphrase['subject'], 'subject');
    print_textarea_row($vbphrase['hn_masspm_message'], 'message', '', 10, 50);

    print_table_break();
    print_table_header($vbphrase['search_criteria']);
    print_user_search_rows(true);

    print_table_break();
    print_submit_row($vbphrase['send']);
}
print_cp_footer();
?>
Reply With Quote
  #217  
Old 06-16-2008, 08:18 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cam you give us an idea of what portion of the code was changed?
Reply With Quote
  #218  
Old 06-16-2008, 08:27 PM
GPTB GPTB is offline
 
Join Date: Mar 2007
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'd have to ask toonysnn - I don't know. Would be interested to know though.
Reply With Quote
  #219  
Old 06-18-2008, 09:58 PM
toonysnn toonysnn is offline
 
Join Date: Sep 2006
Location: Texas
Posts: 511
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This section was changed:
PHP Code:
    $finalcondition "
        
$condition "
         
iif($vbulletin->GPC['overridereceivepm'], """ AND (options & " $vbulletin->bf_misc_useroptions['receivepm'] . ")") . "
        AND user.email <> ''
        " 
iif(!$vbulletin->GPC['user']['adminemail'], " AND (options & " $vbulletin->bf_misc_useroptions['adminemail'] . ")"); 
Reply With Quote
  #220  
Old 06-21-2008, 09:23 AM
KURTZ KURTZ is offline
 
Join Date: Nov 2006
Location: Italy
Posts: 2,257
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Billy, why you don't release this for the 3.7.x version?
Reply With Quote
  #221  
Old 06-21-2008, 09:34 AM
logicuk logicuk is offline
 
Join Date: Jan 2008
Posts: 327
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KURTZ View Post
Billy, why you don't release this for the 3.7.x version?

i 2nd that
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:43 AM.


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.05593 seconds
  • Memory Usage 2,372KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (4)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete