MyBB Community Forums
Mass PM's Mod - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Requests (https://community.mybb.com/forum-65.html)
+---- Thread: Mass PM's Mod (/thread-8896.html)

Pages: 1 2


Mass PM's Mod - Aries-Belgium - 2006-05-12

I couldn't find an existing mod/plugin to send the same pm to several users, so I modded the private.php file to do that (see attachment). I putted // ####... after each line I changed or added.
To be able to enter more names (seperated by ,) in the to input, you will have to edit the private_send template and delete the maxvalue of the "to" input field.
You will alsa have to add this line somewhere in your messages.language.php:
$l['error_pmerror'] = "An error has occured when sending one or more personal messages:";

Installation description:
Quote:-private.php
--REPLACE (+-r282)
$query = $db->query("SELECT u.uid, u.username, u.email, u.usergroup, u.pmnotify, u.pmpopup, u.receivepms, u.ignorelist, u.lastactive, u.language, COUNT(pms.pmid) AS pms_total, g.canusepms, g.pmquota, g.cancp FROM (".TABLE_PREFIX."users u, ".TABLE_PREFIX."usergroups g) LEFT JOIN ".TABLE_PREFIX."privatemessages pms ON (pms.uid=u.uid) WHERE u.username='".addslashes($mybb->input['to'])."' AND g.gid=u.usergroup GROUP BY u.uid");
--WITH
$error_stack = array();
$tousers = explode(",",$mybb->input['to']);
foreach($tousers as $tousername){
$query = $db->query("SELECT u.uid, u.username, u.email, u.usergroup, u.pmnotify, u.pmpopup, u.receivepms, u.ignorelist, u.lastactive, u.language, COUNT(pms.pmid) AS pms_total, g.canusepms, g.pmquota, g.cancp FROM (".TABLE_PREFIX."users u, ".TABLE_PREFIX."usergroups g) LEFT JOIN ".TABLE_PREFIX."privatemessages pms ON (pms.uid=u.uid) WHERE u.username='".addslashes(trim($tousername))."' AND g.gid=u.usergroup GROUP BY u.uid");

--REPLACE (+-r290)
error($lang->error_invalidpmrecipient);
--WITH
//error($lang->error_invalidpmrecipient);
$error_stack[] = $tousername . ": " . $lang->error_invalidpmrecipient;
continue;

--REPLACE (+-307)
error($lang->error_recipientignoring);
--WITH
//error($lang->error_recipientignoring);
$error_stack[] = $tousername . ": ". $lang->error_recipientignoring;
continue;

--REPLACE (+-311)
error($lang->error_recipientpmturnedoff);
--WITH
//error($lang->error_recipientignoring);
$error_stack[] = $tousername . ": ". $lang->error_recipientignoring;
continue;

--REPLACE (+-369)
error($lang->error_pmrecipientreachedquota);
--WITH
//error($lang->error_pmrecipientreachedquota);
$error_stack[] = $tousername . ": " . $lang->error_pmrecipientreachedquota;
continue;

--AFTER
$plugins->run_hooks("private_do_send_end");
--ADD
}
if(count($error_stack) > 0){
$error_msg = $lang->error_pmerror;
$error_msg .= "<ul>";
foreach($error_stack as $error_item){
$error_msg .= "<li>$error_item</li>";
}
error($error_msg);
exit();
}

-inc/lang/<your language>/messages.lang.php
--AFTER
$l['error_nosplitposts'] = "You cannot split this thread as you did not select any posts to split from this thread.";
--ADD
$l['error_pmerror'] = "An error has occured when sending one or more personal messages:";

-TEMPLATE private_send
--REPLACE
<input type="text" name="to" size="40" maxlength="$settings[maxnamelength]" value="$to" tabindex="1" />
--WITH
<input type="text" name="to" size="40" value="$to" tabindex="1" />



RE: Mass PM's Mod - DrPoodle - 2006-05-12

Ummm...Doesn't this already exist in the Admin CP? Under "Mass Email" (changing the delivery method to "Private Message".


RE: Mass PM's Mod - Aries-Belgium - 2006-05-12

DrPoodle Wrote:Ummm...Doesn't this already exist in the Admin CP? Under "Mass Email" (changing the delivery method to "Private Message".
Possibly, but with this mod a normal user can send the same pm to multiple users. By giving in the usernames seperated by a comma in the to-field ...


RE: Mass PM's Mod - DrPoodle - 2006-05-12

Ok, I understand now.

Perhaps you should actually write out an install guide (for people who do not know much php)


RE: Mass PM's Mod - zaher1988 - 2006-05-12

Replaced private.php isn't recommend for some, because they might have done several modifications for this file. For that reason switching you code modification into a plugin will be better.

regards


RE: Mass PM's Mod - Aries-Belgium - 2006-05-12

zaher1988 Wrote:Replaced private.php isn't recommend for some, because they might have done several modifications for this file. For that reason switching you code modification into a plugin will be better.

regards
True, but they can see what I changed ... All the lines I changed are marked with //####... at the end. IMHO this wasn't possible with a plugin Shy


RE: Mass PM's Mod - DrPoodle - 2006-05-12

Having installed the mod I have to say that even for a person who understands php, it was a hard job.

Instead of adding //#### to the end of lines, it is easier to do the following:

//Begin Multi-PM Mod
PHP CODE YOU HAVE CHANGED
//End Multi-PM Mod

If you do that all the way down, people can see very easily, what to change.

Or you could write a Install.txt, where you say "FIND: ......., REPLACE WITH: ........." etc.

Otherwise its a good mod!


RE: Mass PM's Mod - Aries-Belgium - 2006-05-12

Okay, I will write an installation description tonight ...
For my other (3) mods I wrote one, but there were less modifications then now ...

I'm glad you like it ... Big Grin


RE: Mass PM's Mod - IMPAQ - 2006-05-12

Funny enough, a member of my forum asked for this a few days ago. Glad to see someone took the time to put it together.

Nice to see someone's actually making mods nowadays. They're hard to find.

Thanks!


RE: Mass PM's Mod - nekng - 2006-05-12

Ya, i've been waiting for a mod like this, it rocks to see that someone has finaly made it