Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Multiple checkbox field labels and php

  • ahali
  • ahali
  • OFFLINE
  • Posts: 7
  • Thanks: 0
  • Karma: 0
5 years 4 months ago #313418 by ahali
Hi,

I have a custom cb field, type: checkbox (multiple). In php, would it be possible to get all the labels within that checkbox? I'm using language overrides in the labels.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
5 years 4 months ago #313425 by krileon
Replied by krileon on topic Multiple checkbox field labels and php
If you queried for them and ran the labels through CBs CBTxt API, yes. Why are you needing to do this exactly? If you're just trying to get a users translated selected values then substitutions will work fine for that, but if you need them in PHP there's the getFields API which can return the translated selected values as well.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18361-obtaining-field-values-through-getfields-api


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.

  • ahali
  • ahali
  • OFFLINE
  • Posts: 7
  • Thanks: 0
  • Karma: 0
5 years 4 months ago #313491 by ahali
Replied by ahali on topic Multiple checkbox field labels and php
I have a custom made user list view where I have a filtering functionality. User list can be filtered based on what values users have selected in custom cb field, type: checkbox (multiple).

For example:
On registration page there is a checkbox where users can select if they are "student", "employed", "unemployed". Then, the user list can be filtered so that only "student" users are shown.

For filtering, I have a dropdown which I would like to populate with the labels of the multiple checkbox values.
So, in php, is there a way of getting the labels of all the values defined in that checkbox cb field?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
5 years 4 months ago #313500 by krileon
Replied by krileon on topic Multiple checkbox field labels and php
You need to load in CB API and pass the untranslated labels through our CBTxt API. See the below on how to load in CB API. Recommend reviewing existing plugins and modules for how to use the API.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18357-including-cb-api-for-usage-outside-of-cb

To get the available field value/label pairs you can use the query as provided in the below topic.

www.joomlapolis.com/forum/255-developer-members-support/241215-query-for-radiobuttons-dropdopwn-fields-single-select#313321


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.

Moderators: beatnantkrileon
Powered by Kunena Forum