Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 31)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Getuserdata with cb conditional override

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 year 8 months ago - 1 year 8 months 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
Last edit: 1 year 8 months ago by activha. Reason: OUPSSS : someone emptied the fields while I was working, sorry you can delete this post

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
1 year 8 months 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.
Code:
$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.
Code:
$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.
Code:
$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 or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 year 8 months 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 or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
1 year 8 months 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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum