[#6393] problem with cb:else in auto action email

7 years 4 months ago - 7 years 4 months ago #289280 by cpaschen
I've got an email auto action that is sending email notification to admins.

In the body of the email I have:
<li>
<b>Parish/org:</b> [cb:if cb_parishid="9999"][cb:userfield field="cb_parishnamenew" /][cb:else][cb:userfield field="cb_parishid" /][/cb:else][/cb:if]
</li>

However when the email is sent the body gets rendered as:

• Parish/org: New Parish[cb:else]-My Parish/Organization is not listed-[/cb:else]


I have:

CB: Version: 2.1.0+build.2016.12.25.01...
J!: 3.6.5
PHP: 7.0.x
CB AutoActions: Version: 6.3.5+build.2016.12.22.00.
CB Conditional: Version: 4.0.7+build.2016.12.19.16
(and various other CB Plugins, all current)

Any idea why this isn't working?

Please Log in to join the conversation.

7 years 4 months ago #289292 by krileon
Replied by krileon on topic problem with cb:else in auto action email
Does the same usage work fine in a Custom HTML field? That string matches the ELSE REGEXP fine so not sure why it's not working and ELSE usage is working fine in my tests.


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 to join the conversation.

7 years 4 months ago #289317 by cpaschen
Replied by cpaschen on topic problem with cb:else in auto action email
I've tested, and the [cb:else] is NOT working in the custom html element either.
So it appears to be, possibly, that the code didn't get updated OR there is some other very strange conflict.

Can you tell me where to look to see if the updated cb:else code is present (to make sure that the last update with the changes actually got applied)?

Please Log in to join the conversation.

7 years 4 months ago - 7 years 4 months ago #289318 by krileon
Replied by krileon on topic problem with cb:else in auto action email
Install latest CB build over it self to ensure everything is up to date. IF substitutions are parsed in the following file.

libraries/CBLib/CB/Legacy/CBuser.php

Specifically in the _evaluateIfs function. If the substitution IF matches it should remove the ELSE otherwise it should output the ELSE. The ELSE and ELSEIF usage appear to still be working in my tests (in an article via CB Content Bot, in an auto action, and in Custom HTML field). Maybe the quotes are being escaped? If you're using a WYSIWYG editor try viewing the source then adding your substitution.


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 to join the conversation.

7 years 4 months ago #289327 by cpaschen
Replied by cpaschen on topic problem with cb:else in auto action email
I searched and found that the elseif code was there (in the library).

And I did some more testing.

When I use the Else with just plain text:
[cb:if cb_parishid="9999"][cb:userfield field="cb_parishnamenew" /][cb:else]else text[/cb:else][/cb:if]

It works properly.
However, when I try to insert a substitution code in the else close, like this:
[cb:if cb_parishid="9999"][cb:userfield field="cb_parishnamenew" /][cb:else][cb:userfield field="cb_parishid" /][/cb:else][/cb:if]

It no longer works and just displays the else code (as shown earlier).

I've also tried to change the code to just [cb_parishid] and quoting that substitution (and even trying non-user element substitutions) and nothing seems to work to include any substitution of fields within that else clause.

(I've tested with JCE, CodeMirror, and TinyMCE - same results on all editors)

Please Log in to join the conversation.

7 years 4 months ago #289329 by krileon
Replied by krileon on topic problem with cb:else in auto action email
Aha, ok. Was able to confirm your issue. Looking into a fix. Looks like a problem with the REGEXP picking up the other substitution brackets so it's not closing the else usage.

forge.joomlapolis.com/issues/6393


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.238 seconds

Facebook Twitter LinkedIn