Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Black Friday Intro Offer for your subscription's lifetime
🎉 Black Friday sale is here! Great savings on professional and developer memberships! Get 25% off now with code BLACK-FRIDAY-2024!

[SOLVED] Restrict view access on certain fields

  • sirweb
  • sirweb
  • OFFLINE
  • Posts: 226
  • Thanks: 25
  • Karma: 2
6 years 10 months ago - 6 years 8 months ago #301345 by sirweb
Hi,
I want to restrict view access on certain CB fields using Access level or Group.
Example: a comment field, visible for some moderators, but invisible for the user.
I am thinking, in the same manner as you can restrict Edit access to Group using CB Privacy.
Last edit: 6 years 8 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: 48560
  • Thanks: 8292
  • Karma: 1445
6 years 10 months ago #301354 by krileon
Replied by krileon on topic Restrict view access on certain fields
CB Privacy will always allow the profile owner and moderators access the field. Then it checks the viewing user for permission based off the privacy rule selected.

CB Conditional strictly conditions against the profile owner to ensure they meet the supplied criteria. It doesn't care if the user is a moderator.

So with that said it sounds like you want it to display the field if the viewing user has the specified usergroup or view access level or is a moderator. The only way to really do that is to use an IF substitution in a custom value condition using CB Conditional. Example as follows.

Field: Custom > Value
Value: [cb:if user="#me" viewaccesslevel includes "1"]ACCESS[/cb:if]
Operator: Equal To
Value: ACCESS

This would check if the viewing user has the view access level ID of 1 (in this example that's Public) and if they do it outputs ACCESS which is then checked against. I think this could be made easier if CB Conditional could support conditions against the viewing OR displayed user instead of always displayed so have added a feature ticket to look into this for its next feature release.

forge.joomlapolis.com/issues/7003


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.

  • ernienet
  • ernienet
  • ONLINE
  • Posts: 132
  • Thanks: 10
  • Karma: 1
6 years 9 months ago #302305 by ernienet
Replied by ernienet on topic Restrict view access on certain fields
I need to solve a similar problem and found this thread. I installed CB Conditional and tested your example on a field, but it does not seem to be working.

I could not find any instructions on how you built the formula that you used in the Field Value and the Operator Value seems to want #_ or a "get" statement of some kind.

The help videos aren't very helpful for resolving issues like this.

Here's what I need to do:

I want those I designate a Publisher level access in Joomla to be able to edit fields in the profile in a tab called Roles. This is where all the filtering and sorting fields for my lists are maintained. The user does not have access to these because we don't want them to be able to control what list they appear on (board members, sponsors, etc.).

So if I only want Publisher level or above to be able to see and edit these fields on the front-end profile edit (editing other member's profiles), how do I set this up?

I used what you have below, except I set the viewaccesslevel includes "5" (the Publisher level) and I set the Operator to "Greater than or equal to" because I'm a Super and want to be able to make front-end edits as well.

I created a test user with Publisher access, but it's not displaying this field when I am logged in and editing the user on the front-end. I fiddled with various settings (visible, show on profile edit, and the locations options, but I can't seem to find a combination that is correct.

Any assistance you can provide on this will be helpful.

Thank you,
Ernie

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

  • sirweb
  • sirweb
  • OFFLINE
  • Posts: 226
  • Thanks: 25
  • Karma: 2
6 years 9 months ago - 6 years 9 months ago #302312 by sirweb
Replied by sirweb on topic Restrict view access on certain fields
Post moved to the right thread.
Last edit: 6 years 9 months ago by sirweb. Reason: Moved this to another thread, posted in the wring thread here. Sorry.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
6 years 9 months ago #302343 by krileon
Replied by krileon on topic Restrict view access on certain fields
To limit who can edit a field based off the viewing users view access level you can use CB Privacy. Once installed edit the field then under Integrations > CB Privacy set "Edit Display" to "Custom view access level" and if you want it based off usergroup set it to "Custom usergroup" then select your respective view access level or usergroup. Should be all you need to do. The CB Conditional trick is only needed if you want to limit the viewing user from seeing a field on profile view since CB Privacy always allows profile owner to view the field in profile view.


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.

  • sirweb
  • sirweb
  • OFFLINE
  • Posts: 226
  • Thanks: 25
  • Karma: 2
6 years 8 months ago #302568 by sirweb
Replied by sirweb on topic Restrict view access on certain fields
I´m afraid things don´t go my way right now.

I have problems getting the Edit access level to work as I want.
Basically, I need to use 3 different access levels;
User, Local moderator and Global moderator.

So far, I have set CB Privacy Edit Display to Custom usergroup, and Edit Access to an appropriate group, containing the Global moderators.
I haven´t found any other settings in the plugin or in the field, that should affect this?!

The problem is whatever group I set, everybody has edit access.
Can you see of my description if I have missed something obvious?

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

Moderators: beatnantkrileon
Powered by Kunena Forum