[SOLVED] Replacement for Hider

12 years 3 months ago #187682 by tmoran
Replied by tmoran on topic Re: Replacement for Hider
Hi,

I'm struggling with a few things here...

How do I make content only available to unregistered users (public gid="1"). I have tried:

{cb:[cb:if gid="1"]
This content will only appear for unregistered users
[/cb:if]}

It didn't work, is it possible?


Also, is there a way to make content visible to multiple usergroups without having to duplicate the entire content between separate tags? ie:

{cb:[cb:if gid="2","6","7","8","9","10"]
This content will only appear for all logged in users
[/cb:if]}

I have tried numerous variations without success. Only the first gid listed works (in this instance "2")


Lastly, can these settings be applied to parent usergroups? It appears that you have to specify every usergroup individually.



Any help much appreciated...

Please Log in to join the conversation.

12 years 3 months ago - 12 years 3 months ago #187709 by krileon
Replied by krileon on topic Re: Replacement for Hider

How do I make content only available to unregistered users (public gid="1"). I have tried:

{cb:[cb:if gid="1"]
This content will only appear for unregistered users
[/cb:if]}

It didn't work, is it possible?

Please try the below; there's no need to use GID.

[cb:if user_id=""]CONTENT[/cb:if]

Also, is there a way to make content visible to multiple usergroups without having to duplicate the entire content between separate tags? ie:

{cb:[cb:if gid="2","6","7","8","9","10"]
This content will only appear for all logged in users
[/cb:if]}

I have tried numerous variations without success. Only the first gid listed works (in this instance "2")

Yes using REGEX. Please see the below.

[cb:if gid=~"/2|6|7|8|9|10/"]CONTENT[/cb:if]

Alternatively OR separators work as well.

[cb:if gid="2" or gid="6" or gid="7" or gid="8" or gid="9" or gid="10"]CONTENT[/cb:if]

Give you want it to apply to registered users only I suggest the below.

[cb:if user_id>"0"]CONTENT[/cb:if]

Lastly, can these settings be applied to parent usergroups? It appears that you have to specify every usergroup individually.

Yes and no, you could use "gids" which contains an array of all the usergroups the user belongs to. This would then be formatted as id|*|id|*|id I believe so you could use REGEX to just match the parent.


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

Please Log in to join the conversation.

12 years 3 months ago #188298 by tmoran
Replied by tmoran on topic Re: Replacement for Hider
I'm not having much luck here...

I have a usergroup called Customers that has several child usergroups (all with the same permissions)

Public (gid 1)
- Customers (gid 2)
- - Product 1 (gid 3)
- - Product 2 (gid 4)
- - Product 3 (gid 5)
- - Product 4 (gid 6)

Many users belong to multiple groups, however when I try to make content available to them, they can only access content for the last group they belong to...

ie: if a user belongs to gid 4, 5 & 6 then they can only view content allocated to gid 6

I've tried using both REGEX and OR separators, but the same problem occurs with both.

Please Log in to join the conversation.

12 years 3 months ago #188340 by krileon
Replied by krileon on topic Re: Replacement for Hider
gid user variable only returns their top most usergroup id. To get multiple usergroup ids you need to use gids, which should separate them with |*| (e.g. 2|*|3|*|4). Sorry, had misunderstood what you were wanting.


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 to join the conversation.

12 years 3 months ago #188398 by tmoran
Replied by tmoran on topic Re: Replacement for Hider
arggg... I'm obviously doing something wrong. I've tried the following variations:

{cb:[cb:if gid=~"/2|*|8|*|11|*|12|*|13|*|14|*|15|*|16|*|18/"]
CONTENT
[/cb:if]}

{cb:[cb:if gid="/2|*|8|*|11|*|12|*|13|*|14|*|15|*|16|*|18/"]
CONTENT
[/cb:if]}

{cb:[cb:if gid="2|*|8|*|11|*|12|*|13|*|14|*|15|*|16|*|18"]
CONTENT
[/cb:if]}

{cb:[cb:if gid=2|*|8|*|11|*|12|*|13|*|14|*|15|*|16|*|18]
CONTENT
[/cb:if]}

I've also tried "gids" instead of "gid". Where am I going wrong?


Both the following substitutions work, but they only allow access to the top usergroup if a user belongs to multiple groups. I'm hoping this problem will be solved once I can get the above code right...

{cb:[cb:if gid=~"/2|8|11|12|13|14|15|16|18/"]
CONTENT
[/cb:if]}

{cb:[cb:if gid="2" or gid="8" or gid="11" or gid="12" or gid="13" or gid="14" or gid="15" or gid="16" or gid="18"]
CONTENT
[/cb:if]}

Please Log in to join the conversation.

12 years 3 months ago #188423 by krileon
Replied by krileon on topic Re: Replacement for Hider
GID will always only return 1 GID. It doesn't return more then 1 and it doesn't loop through the GIDS. You should be using gids instead, but it appears it's bugged. Normally gids would return id1|*|id2|*|id3, but as it's bugged it doesn't substitute at all. I've created the following bug ticket, provided a proposed patch to resolve it (tested working), and provided a pre-patched CB 1.7.1 file that you can download, copy, paste, replace to have bug resolved with proposed patch.

forge.joomlapolis.com/issues/3157


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.514 seconds

Facebook Twitter LinkedIn