Get Value from Custom USER Fields

  • gvalcho
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 25
  • Thank you received: 0

gvalcho replied the topic: Get Value from Custom USER Fields

You are right. It does work.

However, I do have a further question. The code pulls in the description, not the value. I have a dropdown custom field. An example is: "New York, NY" with value "newyork". When I use the code above, the form is populated with "New York, NY" not "newyork".

For my purpose, that is fine, but if I wanted the value field, what would change?

Thanks, George
#229479
  • gvalcho
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 25
  • Thank you received: 0

gvalcho replied the topic: Get Value from Custom USER Fields

You are correct it does work.
#229480
  • Posts: 2154
  • Karma: 67
  • Thank you received: 264

DarkoCujic replied the topic: Get Value from Custom USER Fields

Hey,

easy. Instead of looking for value inside $customfields, you'd look for rawvalue. Like this:
ff_setValue('gender', $customFields[1]->rawvalue);

Kind regards,
Darko

Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!
#229492
  • Posts: 15
  • Thank you received: 0

dunbarr replied the topic: Get Value from Custom USER Fields

Darko:

I tried your solution, but I think I have the code wrong.

<?php $customFields = FieldsHelper::getFields('com_users.user', JFactory::getUser(), true); return $customFields->value; ?>

I'm trying to pull the value from custom field Organization in a one liner.
#230321
  • Posts: 2154
  • Karma: 67
  • Thank you received: 264

DarkoCujic replied the topic: Get Value from Custom USER Fields

Hey Dunbarr,

that's cause you're not specifying from what element of array to pull the value. $customFields is an array where each element is an array of parameters of each field.
So, you're going to have to output it first to see how your array is structured. Please follow the first part up to and including echo '<pre>'... from this post crosstec.org/en/forums/3-breezingforms-f....html?start=0#229036

When you preview the form, you'll see all the fields available. You have to find the one you need (organization) and then change, in your one-liner, the return so it returns the value from that specific element in the array. (something like return $customFields[2]->value;)

If you get stuck, let me know.

Regards,
Darko

Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!
#230352
The following user(s) said Thank You: dunbarr
  • Posts: 1
  • Thank you received: 0

davidbr117 replied the topic: Get Value from Custom USER Fields

hi DarkoCujic

please could you help me out, ive created a custom field in the backend under user fields called points, i want to output the field in a custom module, ive used the code above but nothing is being displayed
#238536
Moderators: ForumSupporttomeperica
Time to create page: 0.066 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here