Skip to Content Skip to Menu

Auto Actions get field value

  • KatoKalin
  • KatoKalin
  • OFFLINE
  • Posts: 265
  • Thanks: 11
  • Karma: -5
  • Add-ons
10 years 4 months ago #246314 by KatoKalin
Auto Actions get field value was created by KatoKalin
Within a PHP eval code action I need to retrieve a field values
Code:
$field = $cbUser->getField( 'avatar', null, 'html', 'none', 'profile' );

But this does not return anything.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
10 years 4 months ago - 10 years 4 months ago #246335 by krileon
Replied by krileon on topic Auto Actions get field value
You need to establish $cbUser, it doesn't exist in your code. Substitutions can also be used so you could just use the following.

Code:
$field = '[cb:userfield field="avatar" /]';


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.
Last edit: 10 years 4 months ago by krileon.
The following user(s) said Thank You: nant

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

  • KatoKalin
  • KatoKalin
  • OFFLINE
  • Posts: 265
  • Thanks: 11
  • Karma: -5
  • Add-ons
10 years 4 months ago #246422 by KatoKalin
Replied by KatoKalin on topic Auto Actions get field value

krileon wrote: You need to establish $cbUser, it doesn't exist in your code. Substitutions can also be used so you could just use the following.

Code:
$field = '[cb:userfield field="avatar" /]';


I need name dynamically. Would something like this work:
Code:
$cb_name = field1, field2, fieldn $field = '[cb:userfield field=".$cb_name." /]';

I believe that subsitution would not work when using variable as field name.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
10 years 4 months ago #246469 by krileon
Replied by krileon on topic Auto Actions get field value
The substitutions process before the code executes, so no that wouldn't work. You can use getFields API if you want, but please review the below tutorial carefully on how to use it.

www.joomlapolis.com/support/tutorials/120-api-usage/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.

Moderators: beatnantkrileon
Powered by Kunena Forum