Getuserdata with cb conditional override

2 months 1 week ago - 2 months 1 week ago #333366 by activha
Hello

I'd like to get a field with either getField or getUserData and override both access rights and conditions.

I know that I can set full access to true with getField but it seems like it's not possible to override conditions set to hide the fields

How could I get the raw value of a field except getting it directly with a SQL query ?

Thanks

Please Log in to join the conversation.

2 months 1 week ago #333369 by krileon
Replied by krileon on topic Getuserdata with cb conditional override
$fullAccess should cause the conditions to be ignored, but won't work for nesting behaviors. Example as follows.
$avatar = $cbUser->getField( 'avatar', null, 'html', 'none', 'list', 0, true );

Worst case you can try setting an internal flag as shown below to force the bypassing.
$avatar = $cbUser->getField( 'avatar', null, 'html', 'none', 'list', 0, true, [ '_noCondition' => true ] );

_noCondition is a specific behavior in CB Conditional for flagging conditions off. You can also just access the data directly through $user and bypass everything to get the database stored value. Example as follows.
$name = $user->getString( 'name', '' );


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 6 days ago #333374 by activha
Replied by activha on topic Getuserdata with cb conditional override
Could not get the [ '_noCondition' => true ] to work but getString is perfect to use.

Regarding the variable $user, is it only depending on $cbUser = CBuser::getInstance($user_id, false); ?
I mean that whatever the $user_id, the values of $user will always be available with $cb_field = $user->getString( 'cb_field', '' ); ?

Please Log in to join the conversation.

2 months 6 days ago #333376 by krileon
Replied by krileon on topic Getuserdata with cb conditional override
$cbUser is not $user. They are 2 different objects. $cbUser can be used to obtain $user though. Usage of the user object is documented below.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18359-establishing-a-cb-user-object

$user is just the database object for the _comprofiler table. You can directly pull any database column there using the getter functions by supplying the column name.


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.

Moderators: beatnantkrileon
Time to create page: 0.170 seconds

Facebook Twitter LinkedIn