Skip to Content Skip to Menu

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

CB Content Bot and CB Substitutions "gids includes" question

  • ricco1
  • ricco1
  • OFFLINE
  • Posts: 310
  • Thanks: 8
  • Karma: -7
9 years 2 months ago - 9 years 2 months ago #269452 by ricco1
Hi,

I'd like to show some content in a module only if the user group of the viewer or the displayed user is e.g. with ID 3, and then some other content if the user group of the viewer or the displayed user is e.g. with ID 4.

For example let's say I have this 4 user groups like so:

Public (ID 1)
-Registered (ID 2)
--Free users (ID 3)
--VIP users (ID 4)

I've tried a lot of combinations but without complete success.

Here are a few of the combinations I've tried:

-1 start-
{cb}
[cb:if user="#displayedOrMe" gids includes "3"]
Free content
[/cb:if]
[cb:if user="#displayedOrMe" gids includes "4"]
VIP content
[/cb:if]
{/cb}
-1 end-

In this situation I'm expecting to get:

1. If the displayed and I'm Free user3 - Free content;
2. If the displayed is Free user3 but I'm a VIP user4 - VIP content;
3. If the displayed is VIP user4 but I'm Free user3 - VIP content;
4. If the displayed is VIP user4 and I'm a VIP user4 - VIP content;

BUT I'm getting:

1. If the displayed and I'm Free user3 - Free content;
2. If the displayed is Free user3 but I'm a VIP user4 - VIP content;
3. If the displayed is VIP user4 but I'm Free user3 - FREE content;
4. If the displayed is VIP user4 and I'm a VIP user4 - VIP content;



-2 start-
{cb}
[cb:if user="#me" gids includes "3" or user="#displayed" gids includes "3"]
Free content
[/cb:if]
[cb:if user="#me" gids includes "4" or user="#displayed" gids includes "4"]
VIP content
[/cb:if]
{/cb}
-2 end-

-3 start-
{cb}
[cb:if user="#me" gids includes "3"]
Free content
[/cb:if]
[cb:if user="#me" gids includes "4"]
VIP content
[/cb:if]
{/cb}
{cb}
[cb:if user="#displayed" gids includes "3"]
Free content
[/cb:if]
[cb:if user="#displayed" gids includes "4"]
VIP content
[/cb:if]
{/cb}
-3 end-

-4 start-
{cb}
[cb:if user="#me" gids includes "3" or user="#displayed" gids !includes "4"]
Free content
[/cb:if]
[cb:if user="#me" gids includes "4" or user="#displayed" gids !includes "3"]
VIP content
[/cb:if]
{/cb}
-4 end-

First of all, could you answer if its possible to make such a complex substitutions? Like:

[cb:if user="#me" ..... or user="#displayed" .....]

I understood from your other topics that if - else is still not possible, am I correct?

It will be worth a lot to us and much easier for you if you could take your time and give us some more complex examples, other than the ones you've given in:

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb

Thank you,
Best regards,
ricco
Last edit: 9 years 2 months ago by ricco1.

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

  • ricco1
  • ricco1
  • OFFLINE
  • Posts: 310
  • Thanks: 8
  • Karma: -7
9 years 2 months ago #269453 by ricco1
Or may be you still have problem with the user="#displayedOrMe"?

forge.joomlapolis.com/issues/5222

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48473
  • Thanks: 8281
  • Karma: 1443
9 years 2 months ago #269495 by krileon

I'd like to show some content in a module only if the user group of the viewer or the displayed user is e.g. with ID 3, and then some other content if the user group of the viewer or the displayed user is e.g. with ID 4.

Your 1 and 3 scenarios are the only 2 that are valid. The way #displayedOrMe works is it uses the displayed users object (only works on profile) or the viewing users object. It doesn't use both. So it's not testing the displayed then testing the viewing user.

First of all, could you answer if its possible to make such a complex substitutions? Like:

[cb:if user="#me" ..... or user="#displayed" .....]

No, changing the user like that is not possible.

I understood from your other topics that if - else is still not possible, am I correct?

That is correct.

Or may be you still have problem with the user="#displayedOrMe"?

forge.joomlapolis.com/issues/5222

Nope, that's fixed.

It will be worth a lot to us and much easier for you if you could take your time and give us some more complex examples, other than the ones you've given in:

Your usage isn't complex and there's an example for what you're wanting already. What you're needing from the sounds of it is ELSE/ELSEIF usage, which we don't have at this time. We will also be improving our tutorials at a later date after we've launched our new site.


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: ricco1, uperformro

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

Moderators: beatnantkrileon
Powered by Kunena Forum