CB Conditional Module

1 year 1 month ago #332789 by micheleq
CB Conditional Module was created by micheleq
Hello,
My intention is to create a module that shows up to users only when they are eligible for an upgrade. 

On our site, users can upgrade to a higher (Gold) membership, only if they have been members for 2 years. I have solved this but many members want to upgrade but don't realize that the upgrade is possible.

Hence, I would like to display a module for that user only with a text like "Congratulations Joe! You can now upgrade to Gold membership! Go here, etc.

Currently:
  • I have a cronjob run every night counting all members payments and updating a hidden CB field.
  • An additional query field is 1 or 0 if the count is past the threshold (24 months).
  • The upgrade plan only shows to users if the query field is 1 (I do this extra step as I have an override to allow some manually selected users to upgrade before the 2 years). 
I think can achieve this by showing the module if the user has the query field as 1 AND their active membership is one of 3 (standard monthly, semester, annual). 
ACL restrictions won't work as the Gold access is right above the registered access. 

Would the CB Conditional Module be the best option to do this? Can I do it with it? 
Thank you,
Tomás 
 

Please Log in to join the conversation.

1 year 1 month ago #332793 by krileon
Replied by krileon on topic CB Conditional Module
CB Conditional is not a module. It's for conditions tabs and fields. It cannot condition Joomla modules (there are no plans to support this at this time).

My best suggest since you're just trying to display some text is utilize the fact that Joomla won't display empty modules. So you could use a CB Content Module with IF substitutions to handle your conditions. For example you might have the following in your CB Content Module.
[cbsubs:if plan="1" status="A" or plan="2" status="A" or plan="3" status="A"]
	[cb:if cb_queryfield="1"]
		Congratulations [name]! You can now upgrade to Gold membership!
	[/cb:if]
[/cbsubs:if]

That should display the text if they're actively subscribed to plans 1, 2, or 3. Next it checks if your query field has a value of 1. Be sure "Prepare using Content Plugins" is set to "Yes" in your CB Content Module though or the CBSubs substitutions will not work.

If the conditions don't match the module would be empty and shouldn't be rendered so it basically fakes conditionally rendering a module.


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: micheleq

Please Log in to join the conversation.

1 year 1 month ago #332816 by micheleq
Replied by micheleq on topic CB Conditional Module
It's working like a charm, Thank you! 
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.209 seconds

Facebook Twitter LinkedIn