Skip to Content Skip to Menu

Restrict userlist access vased on a CB field

  • joomally
  • joomally
  • OFFLINE
  • Posts: 104
  • Thanks: 8
  • Karma: 1
4 years 5 months ago #318259 by joomally
Previously, I had a menu item of type 'Community Builder » userslist' that linked to a page that displayed the CB User Lists. The actual lists displayed was different for each user and depended on the user's access level, and the lists' access level. Many users just had one list displayed.

I'm trying to reduce the number of user groups, and so am trying to achieve similar functionality using CB fields.
Is there any way to do this ?

I have a CB field which is a 'Query Check Box (Multiple)'.
The check boxes correspond to the user groups, so I just want to show the appropriate list(s) based on which are checked.

The best I could come up with was an article that has a line something like:
[cb:if cb_teams includes "1"]<a href="index.php?option=com_comprofiler&amp;view=userslist&amp;listid=12&amp;searchmode=1">Click here to see list 12</a> [/cb:if]</p>
I use a line similar to this for each list.

Then I have an 'Articles » Single Article' menu item that links to this article.
Whilst this works, its not a great user experience. Since most people only have one list, its quite strange that they have the extra click to get to it.

I was just wondering if there was a better way to do this.

Thanks

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48437
  • Thanks: 8275
  • Karma: 1443
4 years 5 months ago #318271 by krileon
Replied by krileon on topic Restrict userlist access vased on a CB field
Userlist access is based off a view access level only. Best I can suggest is maybe using CB Auto Actions to redirect away from a userlist they don't have access to. You should be able to act on onBeforeDisplayUsersList to do this. Its variables are as follows.

Code:
$_PLUGINS->trigger( 'onBeforeDisplayUsersList', array( &$row, &$users, &$columns, &$fields, &$input, $row->listid, &$search, &$Itemid, 1 ) );

To condition against a specific userlist you'd condition against [var6] which contains the userlist id. Aside from that I recommend considering adding a usergroup based off field value using CB Auto Actions so you can do ACL based checks instead of just field based.


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.

  • joomally
  • joomally
  • OFFLINE
  • Posts: 104
  • Thanks: 8
  • Karma: 1
4 years 5 months ago #318338 by joomally
Replied by joomally on topic Restrict userlist access vased on a CB field
thanks

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

Moderators: beatnantkrileon
Powered by Kunena Forum