Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

File link is not good in result e-mail

More
6 years 1 month ago #5352 by GESign
Dear Aicha,

I would like to get a clickable link in my result e-mail to access the files from the server.
(File attachment is working fine, just my Cu. can not open attachments because of securiy reason.)

So I tried this code in result mail text :
<a href="[FILEUPLOAD]">[FILEUPLOAD]</a>
The result is this:
domain.com/https://domain.com/tmp/001_5ab372eaac9c3.jpg

So the domain with http tag is duplicated.

How could I get the good result in e-mail, please. ( domain.com/tmp/001_5ab372eaac9c3.jpg )

I have tried some options but non of them worked. I use v3.10.4.

Thank you and best regards,
Andrew

More
6 years 1 month ago #5353 by GESign
Replied by GESign on topic File link is not good in result e-mail
We can not see but the links are containing the https:// tags twice as well. So the beginnings start with https:// .Thanks and regards, Andrew

More
6 years 1 month ago #5354 by Administrator AV
Replied by Administrator AV on topic File link is not good in result e-mail
Hi,

I'm sorry for your trouble. At the moments there are limits, to what you can do with the placeholders especially with any field types that can envolve links (url, upload, email). Using a placeholder of an upload field in a href attribute of a link was not an intended use and there are combinations of settings of the form options with which this is not going to work

Cleaning up the placeholder code and the mails is the next point on my todo list but I have not manage to do so, yet.

Your main problem is, that you have set the receipt mail option "Show a download link" to "yes" (in the form configuration). This effects the placeholder which you us in any custom mail text.

One way to solve the problem would be to set the receipt mail option "Show a download link" to "no". Maybe you do not need this option anyway and it is just an accident, that it is set to yes. If you are really sending a receipt mail and do include the data and do want to show a download link in the receipt mail, then you have to fix this as described later.

After the option is set to "no" you can use the placeholder for the upload field in your resul mail text but you have to add the folder (tmp) to the href as well.
<a href="tmp/[FILEUPLOAD]">[FILEUPLOAD]</a>
The text, displayed in the mail will only be the file name then, the href should be the correct link to the file.

If you are really sending a receipt mail and do include the data and do want to show a download link in the receipt mail you can use the Receipt Mail Text and add a link just as with the result mail.

I hope this will fix your problem.

The good thing is, that I'm now aware of this problem and, during refactoring the code, I can take a look and try to improve this.

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

More
6 years 1 month ago #5355 by GESign
Replied by GESign on topic File link is not good in result e-mail
Dear Aicha,

Unfortunately this solution is not working yet because of it adds the correct original file name but the server has the file name modified. For example:
Original file name: 001.jpg
File name on server: 001_5ab3a2cde064e.jpg
So we would need the server file name in the link.

When I don't take the a tag around the file link then the link is perfect just not clickable. Could I change it to clickable in an easy way, or get the modified filename on server?

Best regards,
Andrew

More
6 years 1 month ago - 6 years 1 month ago #5356 by Administrator AV
Replied by Administrator AV on topic File link is not good in result e-mail
Hi Andrew,

you are correct. I didn't take that into account.

As I said, the placeholder was actually not ment to be used in the href of a link to the file. At the moment I see no easy solution for this.

There is one more thing which you could try.
The mails are created in the file components/com_visforms/models/visforms.php. There is a separate function for the result mail and the receipt mail.
You could try the following modification in the code of the function sendResultMail, which creates the result mail.
Replace (line 901)
Code:
if ((!empty($visform->emailresulttext))) { $fixedLinks = JHTMLVisforms::fixLinksInMail($visform->emailresulttext); $body[] = JHTMLVisforms::replacePlaceholder($visform, $fixedLinks); }

With
Code:
if ((!empty($visform->emailresulttext))) { $replacedText = JHTMLVisforms::replacePlaceholder($visform, $visform->emailresulttext); $body[] = JHTMLVisforms::fixLinksInMail($replacedText); }
In theory switching the order in which the text is processed, should fix the problem, but first, I have not tested at all and second, I'm not absolutely sure, if changing the order in which the text is processed may cause a problem at any other point. Therefore I cannot promise, that I can merge this change into the Visforms core, even if it works for you.
If you want to try this, make a copy of the visforms.php file first!!!

I think it is not necessary to modify the function for the receipt mail, because displaying a link is a feature in the receipt mail and does already work.

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
Last edit: 6 years 1 month ago by Administrator AV.

More
6 years 1 month ago #5357 by GESign
Replied by GESign on topic File link is not good in result e-mail
Dear Aicha,

It didn't work for me.

I would like to ask more infos about "displaying a link is a feature in the receipt mail and does already work". What is "displaying a link"? Maybe a switch what I didn't switch.

Thank you and best regards,
Andrew

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum