Furry stuff, oekaki stuff, and other stuff.
You are not logged in.
I need help with one more thing before I'm on my own.
I'm making plans on sending my members OPMail regarding the major changes on my oekaki, however there is a problem...the Mass OPMail feature (in reference to functions.php) does not work. I sent a test OPMail to my "test" account (temporarly made as Super Administrator) and when I hit the Send button, the action had no effect on the account that is being tested on. Something is wrong here.
Here's a snippet of what the Mass OPMail feature looks like:
if ($action == 'massmail') { $send_to = w_gpc('send_to'); $body = w_gpc('body'); $subject = w_gpc('subject'); if ($flags['owner']) { // To whom do we send the messages? $sql_where = "WHERE usrflags != 'P'"; // If we narrow the mass mail to a certain group, we must also update the log if ($send_to != 'G') { if ($send_to == 'A') { $sql_where = "WHERE rank >= ".RANK_MOD; } elseif ($send_to == 'S') { $sql_where = "WHERE rank >= ".RANK_SADMIN; } else { $sql_where = "WHERE usrflags LIKE '%{$send_to}%'"; } w_log(WLOG_MASS_MAIL, "flags({$send_to}): {$subject}"); } if (!empty ($send_to) && !empty ($OekakiU)) { if (empty ($subject)) { report_err($langop_functions_err1); } $result = mysql_query ("SELECT usrname FROM {$OekakiPoteto_MemberPrefix}oekaki ".$sql_where); if ($result) { while ($row = mysql_fetch_array ($result)) { $result3 = mysql_query ("INSERT INTO {$OekakiPoteto_MemberPrefix}oekakimailbox SET sender='{$OekakiU}', reciever='{$row['usrname']}', subject='{$subject}', body='{$body}', send=NOW()"); } } } all_done('mailbox.php'); } else { report_err($langop_functions_err2); } }
I was wondering if there is a way to fix this bug since it's the only bug left to correct on my oekaki.
Offline
Waccoon wrote:
Do you have this in boot.php?
Code:
// Admin rank numbers define ('RANK_MOD', 4); define ('RANK_ADMIN', 5); define ('RANK_SADMIN', 7); define ('RANK_OWNER', 9);
Yep. I certainly do.
The code snippet remains intact. However, there appears to be problem that causes the Mass OPMail to not send users OPMail at all even if the snippet that you mentioned is there in my boot.php file.
Last edited by rainbow (09-07-2008 03:14:15)
Offline
OK, first we need to determine if this is a database problem, or if there is something screwy going on with the input. Replace the massmail routine with this, send a message to "Everyone", and copy/paste what is printed to the forum.
(Obsolete)
Last edited by Waccoon (09-08-2008 23:16:44)
Offline
Waccoon wrote:
OK, first we need to determine if this is a database problem, or if there is something screwy going on with the input. Replace the massmail routine with this, send a message to "Everyone", and copy/paste what is printed to the forum.
Code:
// Mass OPMail if ($action == 'massmail') { $send_to = w_gpc('send_to'); $body = w_gpc('body'); $subject = w_gpc('subject'); web_line('In massmail'); if ($flags['owner']) { // To whom do we send the messages? $sql_where = "WHERE usrflags != 'P'"; // If we narrow the mass mail to a certain group, we must also update the log if ($send_to != 'G') { web_line('Send to: specific'); if ($send_to == 'A') { $sql_where = "WHERE rank >= ".RANK_MOD; } elseif ($send_to == 'S') { $sql_where = "WHERE rank >= ".RANK_SADMIN; } else { $sql_where = "WHERE usrflags LIKE '%{$send_to}%'"; } web_line('SQL condition: '.$sql_where); // w_log(WLOG_MASS_MAIL, "flags({$send_to}): {$subject}"); } else { web_line('Send to: everyone'); } if (!empty ($send_to) && !empty ($OekakiU)) { if (empty ($subject)) { report_err($langop_functions_err1); } $result = mysql_query ("SELECT usrname FROM {$OekakiPoteto_MemberPrefix}oekaki ".$sql_where); if ($result) { $count = 0; while ($row = mysql_fetch_array ($result)) { if ($count < 10) { web_line("INSERT reciever='{$row['usrname']}'"); } $count++; } if ($count > 9) { web_line('...'); } web_line('Count: '.$count); } else { web_line('No usrname collect result: '.mysql_error()); } } else { web_line('No send or OekakiU'); } w_exit(); } else { report_err($langop_functions_err2); } }
Alright, I checked the mySQL database and I got this notice from the functions.php file when attempting to mass-mail a test account:
In massmail
Send to: specific
SQL condition: WHERE rank >= 7
INSERT reciever='test'
INSERT reciever='rainbow'
Count: 2
Yet still, it didn't even insert the SQL entry into the op_oekakimailbox table.
Last edited by rainbow (09-07-2008 04:32:27)
Offline
Yet still, it didn't even insert the SQL entry into the op_oekakimailbox table.
Good. It wasn't supposed to do that -- only to print messages.
It seems that the massmail code is working fine, but the information just isn't getting into the database.
Here's a new version. It prints SQL errors in the specific area that's causing trouble. I does try to insert into the database, so if this code works for some reason, you don't need to replace it again.
(Obsolete)
Last edited by Waccoon (09-08-2008 23:27:35)
Offline
Wac, the mass OPMail notice is indeed working a bit. However. it only sent to the test account that was made as a super administrator. Plus, I received this message when attempting to send the mass OPmail notice to everyone:
No insert for :
Still, sending mass OPmail to all 350 of my members isn't working.
Update : Apparently, there was a typo in the $row['usrname'] variable and now it comes up as:
No insert for test:
I did a check on the $count variable and something is still not working right.
Last edited by rainbow (09-08-2008 00:22:05)
Offline
Well, this is definitely a database issue. We just have to get the error. Note that this code WILL print something no matter what, so once we know what the database is complaining about, we'll have to get rid of all those "web_line()" calls.
I'm trying to be careful, here, so we don't accidentally send notices to a whole group of people multiple times.
I also had the count in the wrong place, so now it will correctly count the total number of failures.
// Mass OPMail if ($action == 'massmail') { $send_to = w_gpc('send_to'); $body = w_gpc('body'); $subject = w_gpc('subject'); if ($flags['owner']) { // To whom do we send the messages? $sql_where = "WHERE usrflags != 'P'"; // If we narrow the mass mail to a certain group, we must also update the log if ($send_to != 'G') { if ($send_to == 'A') { $sql_where = "WHERE rank >= ".RANK_MOD; } elseif ($send_to == 'S') { $sql_where = "WHERE rank >= ".RANK_SADMIN; } else { $sql_where = "WHERE usrflags LIKE '%{$send_to}%'"; } w_log(WLOG_MASS_MAIL, "flags({$send_to}): {$subject}"); } if (!empty ($send_to) && !empty ($OekakiU)) { if (empty ($subject)) { report_err($langop_functions_err1); } $result = mysql_query ("SELECT usrname FROM {$OekakiPoteto_MemberPrefix}oekaki ".$sql_where); if ($result) { $count = 0; web_line("INSERT INTO {$OekakiPoteto_MemberPrefix}oekakimailbox SET sender='{$OekakiU}', reciever='{name}', subject='{$subject}', body='{$body}', senddate=NOW()"); web_line(''); while ($row = mysql_fetch_array ($result)) { $result3 = mysql_query ("INSERT INTO {$OekakiPoteto_MemberPrefix}oekakimailbox SET sender='{$OekakiU}', reciever='".addslashes($row['usrname'])."', subject='{$subject}', body='{$body}', senddate=NOW()"); if (!$result3) { $count++; web_line('No insert for '.$row['usrname'].': '.mysql_error()); } } if ($count > 0) { w_exit(); } } } w_exit(); // all_done('mailbox.php'); } else { report_err($langop_functions_err2); } }
Offline
Waccoon wrote:
Well, this is definitely a database issue. We just have to get the error. Note that this code WILL print something no matter what, so once we know what the database is complaining about, we'll have to get rid of all those "web_line()" calls.
I'm trying to be careful, here, so we don't accidentally send notices to a whole group of people multiple times.
I also had the count in the wrong place, so now it will correctly count the total number of failures.Code:
Obsolete. See final fix for the Mass OPMail snippet below.
Well...it's about time! The mass OPMail feature worked!
However, after the Mass OPMail mail has been sent to all users and administrators, it's supposed to return to the Mailbox (mailbox.php). But it didn't, instead, the web_line variable sent me this comment when the mass OPMail actions inserted rows in the op_oekakimailbox? :?
INSERT INTO op_oekakimailbox SET sender='rainbow', reciever='{name}', subject='Test 3.', body='...', senddate=NOW()
Is there a way to fix that even though the Mass OPMail feature is functioning again?
Edit: I finally got it right this time around after doing some further editing with the functions.php file and rigorous mass OPmail testing. Here's my snippet of the Mass OPMail feature from the functions.php file:
// Mass OPMail if ($action == 'massmail') { $send_to = w_gpc('send_to'); $body = w_gpc('body'); $subject = w_gpc('subject'); if ($flags['owner']) { // To whom do we send the messages? $sql_where = "WHERE usrflags != 'P'"; // If we narrow the mass mail to a certain group, we must also update the log if ($send_to != 'G') { if ($send_to == 'A') { $sql_where = "WHERE rank >= ".RANK_MOD; } elseif ($send_to == 'S') { $sql_where = "WHERE rank >= ".RANK_SADMIN; } else { $sql_where = "WHERE usrflags LIKE '%{$send_to}%'"; } w_log(WLOG_MASS_MAIL, "flags({$send_to}): {$subject}"); } if (!empty ($send_to) && !empty ($OekakiU)) { if (empty ($subject)) { report_err($langop_functions_err1); } $result = mysql_query ("SELECT usrname FROM {$OekakiPoteto_MemberPrefix}oekaki ".$sql_where); if ($result) { $count = 0; while ($row = mysql_fetch_array ($result)) { $result3 = mysql_query ("INSERT INTO {$OekakiPoteto_MemberPrefix}oekakimailbox SET sender='{$OekakiU}', reciever='".addslashes($row['usrname'])."', subject='{$subject}', body='{$body}', senddate=NOW()"); if (!$result3) { $count++; web_line('No insert for '.$row['usrname'].': '.mysql_error()); } } if ($count > 0) { all_done('mailbox.php'); } } } all_done('mailbox.php'); } else { report_err($langop_functions_err2); } }
There are two things that I had to remove...the web_line() and the w_exit() variables upon the insertion of rows into the op_oekakimailbox table when mass sending OPmails to administrators, super administrators or all of the available users. While it only sent me to the message where it inserted rows for a specific action. It went directly to the Mailbox (mailbox.php).
The only thing that the web_line variable will throw at is that it cannot insert rows for a specific username thus returning a MySQL error.
I'm hoping that you include this snippet as a fix real soon. This piece of code is important if someone wants to mass send OPmail to users incase they really have to. One important example is moving the oekaki to a different host.
The Mass OPmail feature will now be used for real to send my members notices regarding the cosmetic changes to the site once I'm all done working on my oekaki. Most importantly, some of my members will need to be e-mailed, because they have not logged on to the site for more than a month or so and that they didn't know what has changed on the oekaki since it was upgraded.
Last edited by rainbow (09-09-2008 13:22:04)
Offline
Well...it's about time! The mass OPMail feature worked!
Are you sure about that? Did everyone (not just admins) get the notice?
The new code you gave me just doesn't let you see any errors because it redirects back to the mailbox. That doesn't mean it worked as it should. I'm trying to figure out the specific reason why your database was throwing errors in the first place.
Offline
Waccoon wrote:
Well...it's about time! The mass OPMail feature worked!
Are you sure about that? Did everyone (not just admins) get the notice?
The new code you gave me just doesn't let you see any errors because it redirects back to the mailbox. That doesn't mean it worked as it should. I'm trying to figure out the specific reason why your database was throwing errors in the first place.
Yes. I'm totally sure about that. Everyone got the OPMail notice (including myself). The new code that I gave you shouldn't throw out errors at all and return to the mailbox.
I have a feeling that the original Mass OPMail code in the functions.php file might not work on some databases.
I was unaware of this problem until I first tested out out the Mass OPMail feature in the first place.
Offline