[FIXED] Announcements: Not sending mass email - User list invisible

 When U are on announcements and you create a new one I found several errors.

  1. If you select that you want to send a email to "all" members, no email is sent.
  2. If you create an announcement that has no attachment you see the message (after the post) -> Could not access file: /var/www/chamilo/courses/PRUEBA01/upload/announcements/
    1. If you select a file, all works fine (no message).
  3. If you decide to send the announcement to a specific user, you CANT SEE any name... There is a filled list but you cant read NO NAMES at all...
    1. If you make a sellection of "invisible names" and if you add them to the "list" then you can send the email to the sellected users...   ->> CONFIRMED, mail goes out. (but only to the first user on list)

 

Picture > DEMO Campus

 

This has been confirmed on 2 different PC, one runing at work, and one at home.

Both PC are running Ubuntu 9.10, apache2, php5, and PHPmailer updated to send on SSL.

The Work PC is linked to a LDAP-Active Dirtectory PC (Dokeos migrated)

My Home PC is a "fresh" setup of Chamilo 1.8.6.2 (just made it to confirm the problem on a fresh install and allso to develop)

The problem is not sending mails, aparently the problem is on announcements code, it does not fill well the user list.

 

Also the problem has been seen on CHAMILO DEMO CAMPUS

Comments

Thanks a lot for enjoying

Thanks a lot for enjoying this theory secern with me. I am appreciating it dread untold! Adscititious nervy to try penalise cerebration. Morality assets to the communicator! all the transactions! hip hop 2012

Came across your blog when I

Came across your blog when I was searching bing I have found a lot of info that I found to be quite useful.
john lennon quotes

I am tiring the same best

I am tiring the same best work from me in the future as well. www.ForeclosureHelp.org

My Home PC is a "fresh" setup

My Home PC is a "fresh" setup of Chamilo 1.8.6.2 (just made it to confirm the problem on a fresh install and allso to develop)Quotes about me

Reported in

Reported in http://support.chamilo.org/issues/562 for application into the code this week

[ FIXED ]

you can download the corrected code from 

www.ceroble.edu.gt/announcements2.tar.gz

 

Email sending problem tracked to file -> /main/announcements/announcements.php

on code "send mail one by one to avoid spam"

The problem is that you enter to a while with one "$result" variable and there inside the while you are making another SQL Query...

So I fixed the code by changing the names of the inner sql's and result's variables to

$sql2, $result2 ..... $sql3, $result3, etc...

I checked Dokeos 1.8.6.1 code and also has the same problem. 

 

---------------------------------------------------------------------------------------------------------- 

 

The attachment error was corrected by changing

This

if (!empty($_FILES['user_upload'])) {

$courseDir = $_course['path'].'/upload/announcements/';

$sys_course_path = api_get_path(SYS_COURSE_PATH);

$sql2 = 'SELECT path, filename FROM '.$tbl_announcement_attachment.'

     WHERE announcement_id = "'.$insert_id.'"';

$result2 = Database::query($sql2, __FILE__, __LINE__);

$row2 = Database::fetch_array($result2);

$data_file = array('path' => $sys_course_path.$courseDir.$row2['path'],

  'filename' => $row2['filename']);

}

 

To this -->>

 

$sql2 = 'SELECT path, filename FROM '.$tbl_announcement_attachment.'

     WHERE announcement_id = "'.$insert_id.'"';

$result2 = Database::query($sql2, __FILE__, __LINE__);

$row2 = Database::fetch_array($result2);

if ($row2['filename'] != "")

{

$courseDir = $_course['path'].'/upload/announcements/';

$sys_course_path = api_get_path(SYS_COURSE_PATH);

$data_file = array('path' => $sys_course_path.$courseDir.$row2['path'],

  'filename' => $row2['filename']);

}

 

 

Other changes to announcements.inc.php

 On file /main/announcements/announcements.inc.php

 

Function -> construct_not_selected_select_form

Changed

 

if (!(in_array("USER:".$this_user["user_id"],$to_already_selected))) // $to_already_selected is the array containing the users (and groups) that are already selected

{

echo "\t\t<option value=\"USER:",$this_user["user_id"],"\">",

"", api_get_person_name($this_user['firstName'], $this_user['lastName']),

"</option>\n";

}

to

 

if (!(in_array("USER:".$this_user["user_id"],$to_already_selected))) // $to_already_selected is the array containing the users (and groups) that are already selected

{

$this_user_info = api_get_user_info($this_user["user_id"]);

echo "\t\t<option value=\"USER:".$this_user["user_id"]."\">".

"".api_get_person_name($this_user_info['firstName'], $this_user_info['lastName']).

"</option>\n";

}

 

Also Funcition -> construct_selected_select_form

Changed

 

// adding the individual users to the select form

foreach($ref_array_users as $this_user)

{

if (!is_array($to_already_selected) || !in_array("USER:".$this_user['user_id'],$to_already_selected)) // $to_already_selected is the array containing the users (and groups) that are already selected

{

echo "\t\t<option value=\"USER:",$this_user['user_id'],"\">",

"", api_get_person_name($this_user['lastName'], $this_user['firstName']),

"</option>\n";

}

}

to

 

// adding the individual users to the select form

foreach($ref_array_users as $this_user)

{

if (!is_array($to_already_selected) || !in_array("USER:".$this_user['user_id'],$to_already_selected)) // $to_already_selected is the array containing the users (and groups) that are already selected

{

$this_user_info = api_get_user_info($this_user["user_id"]);

echo "\t\t<option value=\"USER:".$this_user['user_id']."\">".

"". api_get_person_name($this_user_info['lastName'], $this_user_info['firstName']).

"</option>\n";

}

}

 

Example of the error without fix

Example of the error without fix

 

HTML generated code >>>>   you can see that no name is written in <option> tags.

 <td>

<strong>Usuarios</strong><br />

<select name="not_selected_form[]" size=5 style="width:200px" multiple>

<option value="USER:1"></option>

<option value="USER:101"></option>

</select>

</td>

 

It should be something like -->

<option value="USER:1">MR Bean</option>

<option value="USER:101">Student X</option>

 

Hi carlos

Hi Carlos, Thanks you for report this bug, but I can't see these bug in the version stable, could you say me which version are you using and where you download?. I mean, I have two version of chamilo, the stable version ( working well announcement) and the developmentversion, so I only can see in the development  version this bug, maybe you are downloading the  wrong version. mmm also I try to use the code than you set in this forum, but not all run with my version, for example i can fix with you code the bug number 3 (user list).

Tell me if continuos the problem.

.

Hi

Yep, is on Chamilo Stable

 

http://www.chamilo.org/es/download

http://chamilo.googlecode.com/files/chamilo-1.8.6.2.zip

 

you should check what version are you running on the DEMO campus, cause it has the same problem. (the screenshot is from it).

 

At the begining I thougth Chamilo was woking ok, because I was the first on the list (teacher), but because I was testing chamilo the students where my same email with an alias.... (no extra emails received).

Chamilo aparently works (at least in the version I downloaded) but only the first person on the list receives a message.

 

The problem (on the code I downloaded) was tracked to the mailing part.... someone coded a "send mail one by one to avoid spam" 

there he made a While bucle, but inside that while he has some sql queryes that "drop" his while variable($result) and the next time that repeats it exits...

 

 

The problem was completily fixed by the "hacks" I made... 

Fixed the issue

Hello carlosbrolotobar, the problem is now fixed.

You can see http://code.google.com/p/chamilo/source/detail?r=d2fead88f7177ec4dc1122717ac419bcf04812bb&repo=classic

Thanks for you contribution. Greetings :D