1
jwhite
Re: Bug in mailusers.php - re: sending mail only to users who request it
  • 2003/8/11 7:07

  • jwhite

  • Just popping in

  • Posts: 2

  • Since: 2003/8/11


Yeah, that makes sense. If I'd spent more time figuring out how the code was supposed to work, I probably would have tried that.

Thanks!

Jared



2
jwhite
Bug in mailusers.php - re: sending mail only to users who request it
  • 2003/8/11 0:37

  • jwhite

  • Just popping in

  • Posts: 2

  • Since: 2003/8/11


Hello everyone,

While customizing and adapting XOOPS 2.0.3 to my needs, I found this bug which I haven't heard anyone else talk about yet (just about every other problem I've encountered has already been solved by someone else! ). What I'm trying to do is send e-mail messages to only those users who are interested in receiving e-mails from the site webmasters. This is accomplished on the user end by leaving "Receive occasional email notices from administrators and moderators?" checked in the user profile. When I go to send a message on my (admin) end, I'm checking "Send message only to users that accept notification messages (optional)" on the Mail Users page. Now this works, but not quite. The first user that is found is "lost". In other words, if it finds only one user who requests e-mails, no e-mails are sent. If it finds 10 users, it only sends e-mail to 9 users (users 2 through 10, or 1 through 9 if you start counting at 0).

I found the reason for this. In mailusers.php, located in /modules/system/admin/mailusers, there is the following code starting on line 164 (or thereabouts):

for ( $i $mail_start$i $mail_end$i++) {
    
$xoopsMailer->setToUsers($added[$i]);
}


The problem here is that $mail_start is never set. Perhaps it is set if PHP's "register_globals" setting is turned on, but if it's turned off, this variable doesn't exist. So the first time this for statement runs, $i equals nothing (NULL I suppose), and so the $added[$i] statement returns nothing. The next time the for statement runs, $i equals 1, so it works from then on.

So my solution was simple: add the following statement above that for statement:

$mail_start 0;


Now I have no idea if this breaks something, and it probably does. However, in my tests so far, it works fine. Maybe someone can suggest a superior fix now that this issue has been brought to light.

Anyway, I hope this helps, and I look forward to contributing more feedback, bug reports, and other stuff to the XOOPS community in the future.

Regards,

Jared White




TopTop



Login

Who's Online

186 user(s) are online (129 user(s) are browsing Support Forums)


Members: 0


Guests: 186


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits