Closed Elfangor93 closed 1 year ago
Using the mail templates of Joomla is a cool feature. 👍
While testing, I noticed two things:
Typo in language file:
COM_JOOMGALLERY_MAIL_NEWIMAGE_TITLE="JoomGallery: New Iamge"
I would like to be able to use 'more' variables The following variables would be helpful for use in the mail template for new images: Image-ID - Since the image titles are often not unique, then the ID would be helpful. Image-Title Category-ID - Since the category titles are often not unique, then the ID would be helpful. Category-Title User-ID User-Name User-Username (Login Name (Username))
The following variables would be helpful for use in the mail template for new images
What would be the new content of the mail template using the additional variables you suggested?
What would be the new content of the mail template using the additional variables you suggested?
Suggestion:
COM_JOOMGALLERY_MAIL_NEWIMAGE_BODY="A new image has been added by \"{USER_USERNAME}\" at {SITEURL}.\nTitle of the image is \"{IMG_TITLE}\" and the ID is {IMG_ID}.\nIt has been added to the category \"{CAT_TITLE}\" with the ID {CAT_ID}."
The admin can then still decide for himself whether other things such as the user id should also be shown.
There is one more thing: When uninstalling JoomGallery, all JoomGallery mail templates in the table #__mail_templates should be deleted.
@Elfangor93: Thanks. It looks good for me now (except the two conflicting files).
What is this service for
The Messenger service will be used to send messenges to inform users about tasks beeing perfomed within the gallery. This is a direct replacement of the JoomMessenger helper class of JGv3. This service can send messages eighter via email or via personal messaging system of Joomla. The content of the message is created using the mail templating system of joomla.
How does it work
When you instantiate the service, you have to select a template and provide the values for the variables to be replaced in the chosen template. Additionally you can select a language in which the message should be sent. For this to work there has to be a mail template created for this specific language. By default only an english mail template is installed.
How to use this service
You can load the service anywhere in Joomla by doing
As you can see, you first need to add the corresponding template before you can send messages with its content. With this service only one template is delivered: 'com_joomgallery.newimage'. This is a template to inform users about a new image beeing added (uploaded) to the gallery.
How to test the service
This service need the database to be modified in order to add the new mail template!
Make sure "Debug System" is "Yes" in Joomla Global configuration. Open the file
/administrator/com_joomgallery/src/View/Faulties/HtmlView.php
and insert the following code on line 62 afterthrow new \Exception(implode("\n", $errors)); }
Send a message via email
Send a message via personal messaging system of joomla
Change content of mail template
Navigate in the Joomla backend to "System/Templates/Mail Templates/JoomGallery: New Image" and change the content of the template. When sending a new message the nes content should be sent...