echo "<tr><td colspan=2><b>Private message to users where:</b></td></tr>\n";
makeinputcode("User Name contains","ausername");
if ($pwdincp!=0) {
makeinputcode("and password contains","apassword");
}
makechoosercode("and usergroup is","usergroupid","usergroup",-1,"Any");
makeinputcode("and email contains","aemail");
makeinputcode("and parent's email contains","parentemail");
makeinputcode("and is coppa user (yes, no, blank for don't mind)","coppauser");
makeinputcode("and homepage contains","homepage");
makeinputcode("and ICQ Number contains","icq");
makeinputcode("and AIM Handle contains","aim");
makeinputcode("and Yahoo Messenger Handle contains","yahoo");
makeinputcode("and Biography contains","biography");
makeinputcode("and Signature contains","signature");
makeinputcode("and User Title contains","usertitle");
makeinputcode("and Join Date is after<br>(Format yyyy-mm-dd, leave blank for today)","joindateafter");
makeinputcode("and Join Date is before<br>(Format yyyy-mm-dd, leave blank for today)","joindatebefore");
makeinputcode("and Last Visit is after<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastvisitafter");
makeinputcode("and Last Visit is before<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastvisitbefore");
makeinputcode("and Last Post is after<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastpostafter");
makeinputcode("and Last Post is before<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastpostbefore");
makeinputcode("and Number of Posts is greater than","postslower");
makeinputcode("and Number of Posts is less than","postsupper");
doformfooter();
}
if ($action=="masspm") {
if ($condition=="") {
$condition="1=1";
if ($ausername!="") {
$condition.=" AND INSTR(username,'".addslashes(htmlspecialchars($ausername))."')>0";
}
if ($apassword!="") {
$condition.=" AND INSTR(password,'".addslashes($apassword)."')>0";
}
if ($usergroupid!=-1 and $usergroupid!="") {
$condition.=" AND usergroupid=$usergroupid";
}
if ($aemail!="") {
$condition.=" AND INSTR(email,'".addslashes(htmlspecialchars($aemail))."')>0";
}
if ($parentemail!="") {
$condition.=" AND INSTR(parentemail,'".addslashes(htmlspecialchars($parentemail))."')>0";
}
$coppauser=strtolower($coppauser);
if ($coppauser=="yes") {
$condition.=" AND coppauser=1";
}
if ($coppauser=="no") {
$condition.=" AND coppauser=0";
}
if ($homepage!="") {
$condition.=" AND INSTR(homepage,'".addslashes(htmlspecialchars($homepage))."')>0";
}
if ($icq!="") {
$condition.=" AND INSTR(icq,'".addslashes(htmlspecialchars($icq))."')>0";
}
if ($aim!="") {
$condition.=" AND INSTR(aim,'".addslashes(htmlspecialchars($aim))."')>0";
}
if ($yahoo!="") {
$condition.=" AND INSTR(yahoo,'".addslashes(htmlspecialchars($yahoo))."')>0";
}
if ($biography!="") {
$condition.=" AND INSTR(biography,'".addslashes(htmlspecialchars($biography))."')>0";
}
if ($signature!="") {
$condition.=" AND INSTR(signature,'".addslashes($signature)."')>0";
}
if ($usertitle!="") {
$condition.=" AND INSTR(usertitle,'".addslashes($usertitle)."')>0";
}
if ($joindateafter!="") {
$condition.=" AND joindate>UNIX_TIMESTAMP('".addslashes($joindateafter)."')";
}
if ($joindatebefore!="") {
$condition.=" AND joindate<UNIX_TIMESTAMP('".addslashes($joindatebefore)."')";
}
if ($lastvisitafter!="") {
$condition.=" AND lastvisit>UNIX_TIMESTAMP('".addslashes($lastvisitafter)."')";
}
if ($lastvisitbefore!="") {
$condition.=" AND lastvisit<UNIX_TIMESTAMP('".addslashes($lastvisitbefore)."')";
}
if ($lastpostafter!="") {
$condition.=" AND lastpost>UNIX_TIMESTAMP('".addslashes($lastpostafter)."')";
}
if ($lastpostbefore!="") {
$condition.=" AND lastpost<UNIX_TIMESTAMP('".addslashes($lastpostbefore)."')";
}
if ($postslower!="") {
$condition.=" AND posts>'$postslower'";
}
if ($postsupper!="") {
$condition.=" AND posts<'$postsupper'";
}
}
$users=$DB_site->query("SELECT userid,username,password,email FROM user WHERE $condition");
I have adjusted the script a little bit.
It's now nearly the same as the "Send eMail to users"-Feature, so now you can test the process before sending and all variables get replaced correct.
The Script works perfect for vBulletin 2.2.x!
I have attached the script (German an English version!) to this Posting.
@NAM
Quote:
2. We really need Save function that keep all of our mass PM to users in Send Folder box. To keep for the record.
To save the sent PM in the Send Folder Box of the Admin who sent the PM, do the following (referring to my version of the script):
Actually there are - in your masspm.php - two lines with <b>All done!</b> (one for first page, another for the multiple pages option)
Which of them should I replace with the above INSERT to save the PM in the outbox ?
Besides, the INSERT itself contains three identical values: '$fromuserid','$fromuserid','$fromuserid',
Is it right (I shall not save the single target of each message...) ?
Hwr. that variable is NEVER defined anywhere :stupid: :stupid:
and the other you specified two posts above, should be replaced with something like:
PHP Code:
// insert message in inbox of the receiver
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,showsignature,iconid,messageread,folderid,receipt) VALUES (NULL,$user[userid],$user[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($subject))."','".addslashes($sendmessage)."',".time().",'1',0,0,0,0)");
// insert message in outbox of the sender
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,showsignature,iconid,messageread,folderid,receipt) VALUES (NULL,$bbuserinfo[userid],$user[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($subject))."','".addslashes($sendmessage)."',".time().",'1',0,0,-1,0)");
Originally posted by Jawelin Actually there are - in your masspm.php - two lines with <b>All done!</b> (one for first page, another for the multiple pages option)
This line does not appear two times!!!
There is one line with <b>All done!</b> and one line with <p><b>All done!</b></p> and as I wrote you should replace the second one!
Quote:
Originally posted by Jawelin Besides, the INSERT itself contains three identical values: '$fromuserid','$fromuserid','$fromuserid',
Is it right (I shall not save the single target of each message...) ?
Hwr. that variable is NEVER defined anywhere :stupid: :stupid:
This variable is defined!
PHP Code:
makehiddencode("fromuserid","$bbuserid");
But you are right, you may replace $fromuserid with $bbuserid....I just have taken this from the original "hack".
The reason why this variable appears three times in the "Save-Sent-PM-in-My-Outbox" Feature is simple: you are the sender of the pm, you are the receiver of the pm and the PM belongs to you, so all userids have to be of course the same.
I have tested all of this before I posted it, so just believe me, it works!
Originally posted by bluecat Great hack. I'm wondering, is there a way to put to this in my control panel for easy access (rather then enter the url manually)? Thanks.
Originally posted by JoshFink The only problem I see so far with this is that it does not send out a notification email if when someone receives a PM. Is there a way to fix this?
I have replaced my attachment with the new version.
I have done the eMail Feature + Bugfix long time ago, sorry