JoomGalleryfriends / JG4-dev

Development repository for JoomGallery v4.x
GNU General Public License v3.0
10 stars 6 forks source link

Test Messenger #77

Closed reni68 closed 1 year ago

reni68 commented 1 year ago

I installed the .zip from the PR (JG4-dev-messenger-service.zip) but I can't find any of the JoomGallery in the email templates :(

MrMusic commented 1 year ago

In order to test this PR, the JoomGallery must be newly installed - no update! It is best to uninstall the JoomGallery first and then reinstall the download. Then the mail template should appear.

jobrusche commented 1 year ago

Deinstalling should have the choice to keep categories and images entries in the DB. Now each time I install a new beta-zip? I have to reenter categories and images.

reni68 commented 1 year ago

In order to test this PR, the JoomGallery must be newly installed - no update! It is best to uninstall the JoomGallery first and then reinstall the download. Then the mail template should appear.

OK, that works. But it's a pity that the component has to be uninstalled first. I'm testing :-)

reni68 commented 1 year ago

Is there anything else that needs to be activated?

Elfangor93 commented 1 year ago

There are sample data you can use not to create categories and images again after every fresh install of the component. https://github.com/JoomGalleryfriends/JG4-dev/blob/main/README.md#sample-data

Elfangor93 commented 1 year ago

If you are referring to PR #73 here you have to take into account that this PR is adding a new service. Meaning that it is a bunch of code which is not yet connected to the rest of the component. This results in the fact that configurations as well as tasks reachable from the GUI (like uploads) are not yet affecting the functionality.

In the first comment of each PR it is described what you can expect from the PR and how it has to be tested.

This software is still in alpha phase, meaning that features might not yet be implemented and connected to the GUI and its functions...

reni68 commented 1 year ago

Here's what I tested:

MrMusic commented 1 year ago

It would still be possible to send a message during the upload by changing the upload file. This would require a change in the file administrator/components/com_joomgallery/src/Service/Uploader/HTMLUploader.php. In this file, one of the following codes would have to be entered after line 254.

For sending a mail:

// Mail sending
$recipients = array('test1@example.org', 'test2@example.org', 'test3@example.org');
$this->jg->createMessenger('mail');
$msg = $this->jg->getMessenger();
$msg->selectTemplate('com_joomgallery.newimage');
$msg->addTemplateData(array('user_id' => $data_row->created_by, 'user_username' => 'user_username', 'user_name' => 'user_name', 'img_id' => $data_row->id, 'img_title' => $data_row->imgtitle, 'cat_id' => $data_row->catid, 'cat_title' => $data_row->cat_title));
$msg->send($recipients);

The recipient mail addresses in the first line would of course have to be adapted to your own addresses.

For sending a PN:

// PM sending
$recipients = array('123', '124');
$this->jg->createMessenger('pm');
$msg = $this->jg->getMessenger();
$msg->selectTemplate('com_joomgallery.newimage');
$msg->addTemplateData(array('user_id' => $data_row->created_by, 'user_username' => 'user_username', 'user_name' => 'user_name', 'img_id' => $data_row->id, 'img_title' => $data_row->imgtitle, 'cat_id' => $data_row->catid, 'cat_title' => $data_row->cat_title));
$msg->send($recipients);

The user IDs in the first line would have to be adapted to the IDs of your own installation.

Please note: Not all fields in the mail template are filled correctly. The 'Message' settings in the JoomGallery configuration are still ignored.

But it should be enough to get an impression for this feature.

reni68 commented 1 year ago

It works very well. Email and also PM.