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 🛍️ Intro Black Friday Offer for a lifetime*

[SOLVED] Updating fields in database row

  • jimstrong
  • jimstrong
  • OFFLINE
  • Posts: 63
  • Thanks: 6
  • Karma: 0
  • Add-ons
4 years 9 months ago #316374 by jimstrong
Replied by jimstrong on topic Updating fields in database row
Hi. I thought it might be better to add this supplemental question here to keep the correspondence together.

I successfully got your query working :-
SELECT `id`, CONCAT( `firstname`, ' ', `lastname` ) AS name
FROM `#__comprofiler`
WHERE `cb_shac_role` LIKE '%Office%' OR `cb_shac_role` LIKE '%Befriender%'

This allows the selection of user2 in the record of user1 and allows its display in a CB List, but what I am trying to do now (and failing) is to use a similar query to display the avatar of user2 in the record of user1 and similarly to display it in a CB List.

Can you point me in the right direction please?

Thanks a lot

Jim

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
4 years 9 months ago #316382 by krileon
Replied by krileon on topic Updating fields in database row
You're using a query select field so no that won't be possible since it has no means of passing the selected value through substitutions as nested substitutions are not allowed in normal circumstances. It should be doable with a code field provided by CB Code Field using PHP and getFields API. Example as follows.

Code:
return \CBuser::getInstance( (int) '[FIELD_NAME]', false )->getField( 'avatar', null, 'html', 'none', 'list', 0, true );

Replace FIELD_NAME with the name of your field, which should be a user id. It'd be possible with normal substitutions if the user attribute in substitutions supported a field (e.g. user="FIELD_NAME"), but at this time it does not so have added a feature ticket for that.

forge.joomlapolis.com/issues/7824


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.

  • jimstrong
  • jimstrong
  • OFFLINE
  • Posts: 63
  • Thanks: 6
  • Karma: 0
  • Add-ons
4 years 9 months ago #316391 by jimstrong
Replied by jimstrong on topic Updating fields in database row
Thanks so much - worked a treat! I was also able to pull in a contact number using the same approach.

Jim
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum