Search
Other Email Protector questions
Forum

Use an email address from custom field inside a button on a template override breaks the button

Thomas Thrane's Avatar Thomas Thrane
Hi

I'm a bit confused now...
This is what K2 writes to me:

"I strongly disagree with Peter. His comment "I'm not sure I appreciate and want to keep having to work around issues K2 caused when it changes things which are already non-Joomla standard ways of doing things" is insulting and it's also confusing. Well, boo-hoo. We deal with third party extensions all the time. We don't go trashing the other developers, even if they're bad. Cause in the end, what matters is that the user/customer gets the job done.

I mean, is there like a "non-Joomla standard ways of doing things" for outputting text in a document? If he didn't understand the issue in the first place, he should say so.

Now, if you want to have your emails parsed by his plugin - which BTW should be smarter to perform a regex at the whole <a> element - you should probably re-order that plugin last. Updating K2 may have changed the order of some plugins. Worse case scenario, if you use a link type extra field, switch to plain text field. That should make it simpler for the plugin to grab the email address and convert it to an obfuscated link. "

I tried to reorder the plugins, but same result.
I don't know how to code, so I'm a bit lost here 🙁
Peter van Westen's Avatar Peter van Westen ADMIN
So what kind of field type are you using for this?
Please post a rating at the Joomla! Extensions Directory
Thomas Thrane's Avatar Thomas Thrane
I'm using Text Field (plain text)

Peter van Westen's Avatar Peter van Westen ADMIN
Ok, added an extra workaround for K2.
Please try the latest development version from:
regularlabs.com/development-releases
Please post a rating at the Joomla! Extensions Directory
Peter van Westen's Avatar Peter van Westen ADMIN
Ok, new try:
regularlabs.com/development-releases
Please post a rating at the Joomla! Extensions Directory
Thomas Thrane's Avatar Thomas Thrane
Now both are with the old error again.
Peter van Westen's Avatar Peter van Westen ADMIN
Looks like you installed the stable version, not the dev version.
Please post a rating at the Joomla! Extensions Directory
Thomas Thrane's Avatar Thomas Thrane
Sorry... Works now! 🙂

Thank you so much!
Thomas Thrane's Avatar Thomas Thrane
Hi Peter

I'm using this setup in a K2 override:
<div class="email"><a href="mailto:<?php echo $extrafields->get(9); ?>"><?php echo $extrafields->get(9); ?></a></div>
But the output becomes:
Confidential information:
(hidden)

See: gb.thr.nu/kontakt

Any ideas regarding this?
Seems like the same issue as I had above, but I can't see why this fails on this new site.

Kind regards
Thomas
Peter van Westen's Avatar Peter van Westen ADMIN
It looks like the plugins have already been run over the output of the $extrafields->get(9).
So that already contains the cloaked email code.
Meaning you can pretty much just replace it with:
<div class="email"><?php echo $extrafields->get(9); ?></div>
Please post a rating at the Joomla! Extensions Directory
Thomas Thrane's Avatar Thomas Thrane
Thanks, I'm aware, but what if I would like to have af title on the link?
Peter van Westen's Avatar Peter van Westen ADMIN
So the actual issue here is that the content of the field is being passed through the plugins before you want it. That is outside the control of Email Protector, really.
So see if there is a way in the php code to output the rawvalue of the field instead.
Please post a rating at the Joomla! Extensions Directory
Thomas Thrane's Avatar Thomas Thrane
Ok, but on this page it works?

www.sawo.dk/da/job-i-sawo
Look at the link with the paperplane.

That code is:
<a class="buttonLink" title="Send til <?php echo $extrafields[28];?>" href="mailto:<?php echo $extrafields[28];?>"><?php echo JText::_('SAWO_SEND_APPLICATION'); ?> <?php echo JText::_('SAWO_TO'); ?> <?php echo $extrafields[28];?><i class="fas fa-paper-plane"></i></a>
Thomas Thrane's Avatar Thomas Thrane
Tried with the raw output, but same issue:
<?php echo $item->extraFields->Email->value; ?>

gb.thr.nu/kontakt

getk2.org/documentation/tips-a-tricks/di...e-in-your-k2-content
Peter van Westen's Avatar Peter van Westen ADMIN
Well, added a more greedy exception for K2 extrafields. So it should work now on your setup and in the latest dev version:
www.regularlabs.com/development-releases

Again, this is really a K2 issue. I have just implemented specific code to work around their issue.
Please post a rating at the Joomla! Extensions Directory
Thomas Thrane's Avatar Thomas Thrane
You're the best!

Thanks a lot!!!
You can only post on this forum if you log in