CB query fields question

2 months 1 week ago #330933 by krileon
Replied by krileon on topic CB query fields question

Just a follow up : it seems that the access parameter solve the access rights but has no effect on the control made by CBsubs.

I don't understand what you mean by this. Control made by CBSubs?


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.

2 months 1 week ago #330934 by activha
Replied by activha on topic CB query fields question
We had an old control by CBSubs Fields Tabs Protect limiting field visibility by viewer's subscriptions to limite the view to Moderators plan

Please Log in to join the conversation.

2 months 1 week ago #330936 by krileon
Replied by krileon on topic CB query fields question
That variable can be ignored by plugins if they so choose. CB Conditional and CB Privacy will both respect $fullAccess value. CB Conditional can condition against CBSubs so that's an alternative if you still need that condition. The alternative is having to get the PHP version of a field to bypass all access checks, but that gets a bit more complicated.


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.

2 months 1 week ago - 2 months 1 week ago #330938 by activha
Replied by activha on topic CB query fields question
Cool that CB conditional has been upgraded this way :-)

I tried to condition to viewing user only and to mods only but it does not display with 
$cbUser->getField( 'cb_refid' , '', 'html', 'none', 'profile', 0, true, null);
or neither with 
$cbUser->getField( 'cb_refid');

If I remove the conditions then it displays correctly

Are you sure that CB Conditional respects full access ?

Please Log in to join the conversation.

2 months 1 week ago #330946 by krileon
Replied by krileon on topic CB query fields question
Yes, but the field might be removed elsewhere in the field API chain by conditions. I don't understand why you're conditioning something you need accessible to technically a user that should not have access to it.

Move the field to a tab in a not shown on profile position. Next remove all conditions against it. Now create a Custom HTML field that substitutes the field in. Then add your conditions to the Custom HTML field. This separates the rendering on profile from the field itself. It can now be used externally safely regardless of how the Custom HTML field renders it on profile. Example as follows.

cb_refid = query field, no conditions, on tab in not shown on profile position
cb_refid_display = custom html field, substitutes in cb_refid, has conditions and any other access checks needed on it, used for display on profile/userlist

Having this separation will prevent any and all access problems. Custom HTML and Query fields have no _comprofiler column storage so you can quite literally have unlimited amounts of them without performance or storage concerns so feel free to do this with any fields that need dual access behaviors.

With CB 3.0 will look into an explicit API access for fields that makes more sense to try and bypass any checks. The alternative is trying to use the PHP output to bypass checks. Example as follows.
$value			=	$user->getField( 'cb_refid', null, 'php', 'none', 'profile', 0, true );

if ( is_array( $value ) ) {
	$value		=	array_shift( $value );

	if ( is_array( $value ) ) {
		$value	=	implode( '|*|', $value );
	}
}

This is the same as doing [FIELD_NAME] to get raw values except it works with non-stored fields.


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

Please Log in to join the conversation.

2 months 6 days ago #330953 by activha
Replied by activha on topic CB query fields question
Thanks a lot for these explanations.
For now I think I'll use the PHP way which is easier to implement in our code without changing all the displays in the profiles.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.238 seconds

Facebook Twitter LinkedIn