Skip to Content

New J2Commerce 6.6.5 is out. Here is everything in the release.

See What’s New
Account
Enter the email address on your account.
Forgot your username?
Enter your password.
Forgot your password?

Or continue with

Pending Public Category: Technical Support / Bugs Ticket #1118

plg_content_j2commerce re-dispatches onContentPrepare for every context (breaks Email Cloak in third-party emails)

This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

J2Commerce

Version
J2Commerce v6

Conversation

Olivier Le Helloco

Hello,

On J2Commerce 6.6.4 (Joomla 6.1), the content plugin plg_content_j2commerce re-dispatches onContentPrepare at the end of its own onContentPrepare() handler (the “prepare_content” block, src/Extension/J2Commerce.php). It does this for any context, not only for articles or products.

Consequence. When another extension runs content plugins on its own text, every content plugin runs twice. One case we hit: Convert Forms passes the e-mail body of a form submission through HTMLHelper::_('content.prepare', $body, null, 'convertforms.email'), after appending {emailcloak=off}.

  1. J2Commerce (ordering 0) re-dispatches onContentPrepare.
  2. Inside that nested dispatch, Joomla’s Email Cloak plugin sees {emailcloak=off}, removes the marker and does not cloak.
  3. The outer dispatch then reaches Email Cloak (ordering 3) a second time. The marker is gone, so the address gets cloaked.

The notification e-mail then shows “This email address is being protected from spambots…” instead of the sender’s address.

How to reproduce. With J2Commerce’s content plugin enabled (“Prepare Content” = Yes) and Email Cloak enabled, run:

echo HTMLHelper::_('content.prepare', '{emailcloak=off}<a href="https://www.j2commerce.com/mailto:test@example.org">test@example.org<;/a>', null, 'any.context');
 

The address is cloaked. With the J2Commerce content plugin disabled, it is not.

Expected. The re-dispatch should only run where J2Commerce has rendered something: product/article contexts (com_content.*, com_j2commerce.*), or only when the text actually contained a {j2commerce} shortcode or a product block. An option to list excluded contexts would also do.

There is no workaround through the plugin options. “Prepare Content” = No strips the other plugin tags from our articles ({loadmoduleid}…), and “Preserve Tags” triggers the same re-dispatch.

Thank you!