Skip to Content Skip to Menu

🕒 Save Time and Effort with CB Editor Assistant: Effortlessly create and refine content in Joomla 3, 4, & 5.
🎁 Limited Offer: Enjoy a 5-day FREE trial and save up to 30% afterward!

[SOLVED] Substitution syntax issue related to operator

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
12 years 2 months ago - 12 years 2 months ago #213818 by dotcom22
hello

I would like display some infos inside Cbsubs plan description + inside CB Login module (inside Logout Pre-text field) according to some CB field value. I noticed when using some operator, substitution don't work correctly...It seem you have some formatting uppercase/lowercase issue related to operator "or". Now I don't know if this is intentional and I hope not because if yes this is quite confusing...

Example:

If I put the follow substitution in my plan description:

[cb:if cb_subscriptionstatus!="ACTIVE" or cb_subscriptionstatus!="RENEWED"]My text[/cb:if]

..if the value ACTIVE or RENEWED is present inside field cb_subscriptionstatus, the text still displayed when normally it must be hidden.

Now if I put the follow substitution:

[cb:if cb_subscriptionstatus!="ACTIVE" OR cb_subscriptionstatus!="RENEWED"]My text[/cb:if]

..the text is well hidden. Note the difference between the two substitution is only related to operator "or" who is in uppercase/lowercase.

This seem to affect only substitution where operator not equal (that mean !=) is also used because when using operator equal (that mean =) I can write operator or in lowercase.


For avoid any confusion, the fact to use operator "or" with the syntax || would be better like that we don't need to worry about uppercase/lowercase. I tried to use this syntax but without success and when I use for replace or/OR nothing happen.

So in practice if I need to use operator or:

1) When I'm supposed to use the syntax or ?
2) When I'm supposed to use the syntax OR ?
3) When I'm supposed to use the syntax || ?

thank

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins
Last edit: 12 years 2 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48708
  • Thanks: 8319
  • Karma: 1447
12 years 2 months ago #213915 by krileon
Usage is exactly as my tutorial below explains.

www.allmysocials.com/directory/tutorials/item/233-substitution-usage

You can use "or" or "||". "OR" is not valid, needs to be lowercase. The suggested usage is "or".


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.

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
12 years 2 months ago #213948 by dotcom22

You can use "or" or "||". "OR" is not valid, needs to be lowercase. The suggested usage is "or".


Ok I take note...however like I said using "or" don't work when I use operator != in my substitution (see my example). But if I use "OR" the substitution work..reason why I ask you if something is wrong about upercase/lovercase.

Now maybe I do something wrong...so for resume:

In my field "cb_subscriptionstatus" I have the value "ACTIVE" so if I use this substitution inside my plan:

[cb:if cb_subscriptionstatus="ACTIVE" or cb_subscriptionstatus="RENEWED"]My text[/cb:if]

the text "My text" must be displayed...right ?

Now if I use the substitution

[cb:if cb_subscriptionstatus!="ACTIVE" or cb_subscriptionstatus!="RENEWED"]My text[/cb:if]

the text "My text" must be hidden...always right ?

In this last case "My text" is always displayed...but if I replace or by OR, "My text" is well hidden.

any clue ?

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48708
  • Thanks: 8319
  • Karma: 1447
12 years 2 months ago #213951 by krileon
Using OR is causing the substitution to fail completely, which is why the text is hidden. When using != you probably want to use "and" instead. As you're testing against a single field though you should be using regex as follows.

[cb:if cb_subscriptionstatus=~"/ACTIVE|RENEWED/"]Is equal to one of the two.[/cb:if]

[cb:if cb_subscriptionstatus!~"/ACTIVE|RENEWED/"]Not equal to either of the two.[/cb:if]


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.

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
12 years 2 months ago #214142 by dotcom22
excellent you right, regex is what I need and now everything is fine. :cheer:

thank

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

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

Moderators: beatnantkrileon
Powered by Kunena Forum