Skip to Content Skip to Menu

[#3549] cbsubs promotion - conditional upon email?

12 years 6 months ago - 12 years 4 months ago #196882 by akasharkbow
Hi there

I am trying to create a CBSubs promotion that is open only to users from a certain company.

In addition to providing them with a promotion code, I also want to check their email address ends with @company.com. (This is to prevent non-employees from using the code, as the company intends to share the code on their web pages.)

Does the "Advanced Promotion Conditions" in a promotion allow for this? I cannot get it to work using:
Date A, Field A: Following CB Field
CB Field A: email
Date B, Field B: constant value or string
Value B: company.com
Condition: Value A contains Value B

Thanks so much.
Last edit: 12 years 4 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 6 months ago #196895 by krileon
Can't recall how contains works, but you may want to try the REGEX approach instead. Please see example as follows.

Date A, Field A or Value A: Constant Value or String (CB substitutions can be used)
Value A: @company\.com$ (if it requires delimiters put: /@company\.com$/)
Date B, Field B or Value B: Following CB field
CB Field B: email
Condition 1 (> for Dates): Regexp in Value A matches the value contained in Value B


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.

12 years 6 months ago #196993 by akasharkbow
Replied by akasharkbow on topic Re: cbsubs promotion - conditional upon email?
Hi krileon

Thanks for the help. I've tried what you suggested and it's kicking back the following error, which appears on the invoice page during registration (where the user can enter the coupon code):

Warning: preg_match() [function.preg-match]: Empty regular expression in [...]/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/cbpaidsubscriptions.condition.php on line 196

I had to adapt the approach you suggested, as the conditions appearing on the drop-down menu were slightly different - maybe this is the problem:

Date A, Field A or Value A: Following CB field
Value A: email
Date B, Field B or Value B: Constant Value or String (CB substitutions can be used)
CB Field B: @company\.com$
Condition 1 (> for Dates): Value A matches the Regexp contained in Value B (this was the only Regexp condition available)

Thanks for your assistance and patience with this.

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

  • nant
  • nant
  • ONLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
12 years 6 months ago #197011 by nant
To use Promotions you need to have Tax plugin installed - do you?

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

12 years 6 months ago #197029 by akasharkbow
Replied by akasharkbow on topic Re: cbsubs promotion - conditional upon email?
Yes, it's installed and published. Other (non-conditional) promotions are working.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 6 months ago #197032 by krileon

Warning: preg_match() [function.preg-match]: Empty regular expression in [...]/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/cbpaidsubscriptions.condition.php on line 196

I suggested 2 values as I can not see CBSubs source and do not know how it uses REGEX. Please try the alternative as suggested earlier and also below.

/@company\.com$/


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.

Moderators: beatnantkrileon
Powered by Kunena Forum