Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount! Get 20% off now with code SPOOKY-2024!

[SOLVED] Substitution conditionals being rewritten in auto actions

11 years 9 months ago - 11 years 9 months ago #218924 by sjpetteruti
Greetings,

I am trying to set up an auto action to send an email with user registration information to site administrators. I have it set up currently as a html formatted email action set to trigger on the onafteruserregistration trigger.

The email gets sent fine except that the formatting is way off because of the issue i'm writing about which is that when trying to use the cb conditional substitutions my html is getting rewritten on save. For example:
<strong>Address:</strong> [cb_billinginformation] - Works just fine.

But when I try to use:
[cb:if cb_address2!=' ']<strong>Suite/Floor/Office:</strong> [cb_address2]<br/>[/cb:if]

It is rewritten as such, using html character codes:
[cb:if cb_address2!=' ']&lt;strong&gt;Suite/Floor/Office:&lt;/strong&gt; [cb_address2]&lt;br/&gt;[/cb:if]

This is probably something simple but its causing me some frustration. To note I am using a super user account with no filtering turned on along with JCE and no filtering enabled.

Thanks
Last edit: 11 years 9 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
11 years 9 months ago #218930 by krileon
Substitutions are being escaped. Edit the following file to disable the escaping.

IN: components/com_comprofiler/plugin/user/plug_cbautoactions/models/email.php
ON: Line 36
FROM:
Code:
$mailBody = cbautoactionsClass::getHTMLCleanParam( 'email_body', null, $trigger->get( 'params' ), $trigger );
TO:
Code:
$mailBody = cbautoactionsClass::getHTMLCleanParam( 'email_body', null, $trigger->get( 'params' ), $trigger, false );


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

11 years 9 months ago #218932 by sjpetteruti
Thanks for the quick response.

I have made the changes suggested to line 36 of email.php, and I also cleared Joomla cache to make sure the changes were being loaded as well as my browser cache because, well, Browser cache has always been a thorn in my side.

The conditional's <'s and >'s are still being escaped.

Are there any additional steps I need to take?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
11 years 9 months ago #218936 by krileon
Nope, that should've fixed it as that turns off htmlspecialchars for the substitutions. Is the escaping happening when you save the auto action or when the email sends?


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

11 years 9 months ago #218945 by sjpetteruti
It is escaping the characters when I save the email and when it comes through in the email it literally says <strong> and <br/> instead of the intended format.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
11 years 9 months ago #218952 by krileon
Add the following code to the following file below the "validation" function.

IN: components/com_comprofiler/plugin/user/plug_cbautoactions/models/email.php
Code:
/** * @param cbParamsBase $params * @param cbautoactionsTriggers $row * @param moscomprofilerUser $user * @param $plugin */ public function beforeSetParams( $params, $row, $user, $plugin ) { $params->set( 'email_body', cbautoactionsClass::getRAWParam( 'email_body', null, $_POST['params'] ) ); }

Confirmed above resolves it.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: sjpetteruti

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum