Skip to Content Skip to Menu

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

[SOLVED] Plan image also for the Free Registered Users (without subscriptions)

  • liaskas
  • liaskas
  • OFFLINE
  • Posts: 382
  • Thanks: 36
  • Karma: 2
  • Add-ons
7 years 11 months ago - 7 years 11 months ago #288062 by liaskas
Hello

I am trying to use substitutions with cb_userplan (plan image) field that will show on profile view. I have done it before and use it with other field types that show fine on my site.

What i tried...

Parameters / Layout / Profile Value Layout

First try (on cb_userplan= id)
[cb:if user="#displayed" cb_userplan="First plan id"]<img src="images/stories/plan1.png" alt="..."> [/cb:if]
[cb:if user="#displayed" cb_userplan="Second plan id"]<img src="images/stories/plan2.png" alt="..."> [/cb:if]
[cb:if user="#displayed" cb_userplan="Third plan id"]<img src="images/stories/plan3.png" alt="..."> [/cb:if]

Result: No image shows at all

Second try (on cb_userplan= alias)
[cb:if user="#displayed" cb_userplan="First plan alias"]<img src="images/stories/plan1.png" alt="..."> [/cb:if]
[cb:if user="#displayed" cb_userplan="Second plan alias"]<img src="images/stories/plan2.png" alt="..."> [/cb:if]
[cb:if user="#displayed" cb_userplan="Third plan alias"]<img src="images/stories/plan3.png" alt="..."> [/cb:if]

Result: No image shows at all

Third try (on cb_userplan= plan name)
[cb:if user="#displayed" cb_userplan="First plan name"]<img src="images/stories/plan1.png" alt="..."> [/cb:if]
[cb:if user="#displayed" cb_userplan="Second plan name"]<img src="images/stories/plan2.png" alt="..."> [/cb:if]
[cb:if user="#displayed" cb_userplan="Third plan name"]<img src="images/stories/plan3.png" alt="..."> [/cb:if]

Result: No image shows at all


First try (on the way we call the image)
[cb:if user="#displayed" cb_userplan="First plan id"][cb:userfield field="cb_userplan" /] [/cb:if]
[cb:if user="#displayed" cb_userplan="Second plan id"][cb:userfield field="cb_userplan" /] [/cb:if]
[cb:if user="#displayed" cb_userplan="Third plan id"][cb:userfield field="cb_userplan" /] [/cb:if]

Result: No image shows at all

Second try (on cb_userplan= alias)
[cb:if user="#displayed" cb_userplan="First plan alias"][cb:userfield field="cb_userplan" /] [/cb:if]
[cb:if user="#displayed" cb_userplan="Second plan alias"][cb:userfield field="cb_userplan" /] [/cb:if]
[cb:if user="#displayed" cb_userplan="Third plan alias"][cb:userfield field="cb_userplan" /] [/cb:if]

Result: No image shows at all

Third try (on cb_userplan= plan name)
[cb:if user="#displayed" cb_userplan="First plan name"][cb:userfield field="cb_userplan" /] [/cb:if]
[cb:if user="#displayed" cb_userplan="Second plan name"][cb:userfield field="cb_userplan" /] [/cb:if]
[cb:if user="#displayed" cb_userplan="Third plan name"][cb:userfield field="cb_userplan" /] [/cb:if]

Result: No image shows at all

and many more combinations that we could imagine or found on forums.

Why we want to substitute the plan image.

CBSubs general global settings for our site
1. Allow Free Registered Users (without subscriptions) YES
2. Create Subscriptions also for free lifetime plans NO

Our first plan is Free Lifetime

If we are viewing a member with a paid subscription, the plan image shows right on user profile view.
If we are viewing a member with the Free lifetime subscription, no plan image shows. Just the "-" of community builder empty field.

All of our plans have a plan image justified.

So our goal is...
to show a plan image also for the Free Registered Users (without subscriptions).

Please tell us if this issue can be resolved somehow. Maybe there is a trick that we do not know.
Creating subscription also for lifetime users is not an option because of huge number of members (about 25000) that do not pay on regular bases. So if someone pays, after the expiration of the paid membership, he returns to the Free Lifetime subscription.

Else please help us make the above substitution recipe (or another recipe) working.

Thank you.
Last edit: 7 years 11 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
7 years 11 months ago #288089 by krileon
The Plan Image fieldtype, just like the Image fieldtype, returns the URL to the image it's displaying when using the raw substitution. It does not return the plan id. This means your condition should probably just REGEXP for the image filename and should accomplish the same thing. If you want to show a plan image for users without a subscription I'd simply check that the plan image field is empty. Example as follows.

[cb:if cb_userplan!=""][value][cb:else]<img src="FREE_USER_IMAGE_PATH" />[/cb:else][/cb:if]

This would be placed in the profile value layout parameter under Parameters > Layout of your plan image field. See the substitution tutorial below for our new elseif and else condition usages. Note you need latest CB build for elseif and else usages to work.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18353-using-substitutions-throughout-cb
www.joomlapolis.com/blog/kyle/18708-substitution-power-up


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.

  • liaskas
  • liaskas
  • OFFLINE
  • Posts: 382
  • Thanks: 36
  • Karma: 2
  • Add-ons
7 years 11 months ago #288112 by liaskas
Thank you for your answer kyle.

Joomla! Version: Joomla! 3.6.4 Stable
Community builder: Latest version 2.0.15
CBSubs version: Latest

Ok...

I used the following in the profile value layout parameter

[cb:if user="#displayed" cb_userplan!=""][cb:userfield field="cb_userplan" /][cb:else]<img src="images/stories/plan1.png" />[/cb:else][/cb:if]

It returns...
[cb:else](The plan1.png shows here even if the user has a paid subscription active)[/cb:else]

any ideas?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
7 years 11 months ago #288118 by krileon
You need to use the latest CB build. You're on latest stable. Latest build is 2.0.15+build.2016.11.17.23.30.51.00b5b220a.


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.

  • liaskas
  • liaskas
  • OFFLINE
  • Posts: 382
  • Thanks: 36
  • Karma: 2
  • Add-ons
7 years 11 months ago #288124 by liaskas
Yes you are right!

Installed the latest build 2.0.15+build.2016.11.17.23.30.51.00b5b220a

but...

[cb:if user="#displayed" cb_userplan!=""][cb:userfield field="cb_userplan" /][cb:else]<img src="images/stories/plan1.png" />[/cb:else][/cb:if]

returns "-" no matter if the user has a paid subscription plan active.

Field Title is _UE_PROFILE_TYPE
Field Name is cb_userplan

Can you please confirm that the above script is right?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
7 years 11 months ago #288146 by krileon
You do not need the user="#displayed" as that's already the case for fields usages. The below should work fine.

[cb:if cb_userplan!=""][value][cb:else]<img src="images/stories/plan1.png" />[/cb:else][/cb:if]

Try using a Custom HTML field if the Layout isn't working as don't recall if plans image field was updated with layout functionality. For Custom HTML field you'd need to use the below though.

[cb:if cb_userplan!=""][cb:userfield field="cb_userplan" /][cb:else]<img src="images/stories/plan1.png" />[/cb:else][/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.

Moderators: beatnantkrileon
Powered by Kunena Forum