Home › Forums › Community Forum › Get values from Custom Field Multiple Select
This topic contains 15 replies, has 4 voices. Last updated by Simon Groves 3 years, 10 months ago.
Topic Author | Topic |
---|---|
Posted: Wednesday Feb 13th, 2013 at 6:57 am #41601 | |
|
|
Hi Guys, Hope someone can help!? I’ve just installed S2Members Pro (awesome!) and setting up custom fields. I’ve worked out how to return custom fields for standard text but how do I get the value or values from a multiple select? Your help is very much appreciated. Thanks in advanced |
List Of Topic Replies
Author | Replies |
---|---|
Author | Replies |
Posted: Thursday Feb 14th, 2013 at 8:11 pm #41739 | |
![]() |
|
Hello Ian, What do you mean with a field with multiple selections? Also, your account doesn’t seem to show you have the pro version, how did you acquire the pro version? – Eduan |
|
Posted: Friday Feb 15th, 2013 at 4:24 am #41811 | |
|
|
Hi Eduan Thanks for getting back to me. I think the confusion may come from I’ve ended up with 2 S2Memer accounts. One I initially setup to enquire and one I then had to create for the company in order to purchase the s2member pro licence. I’m more than happy to send through any information to validate our account, simply let me know what you need and who I need to send it to. As for the query above, I’ve created an additional custom registration field which is a Select Menu with multi-option which I did from here: General > Profile Fields/options > Custom Registration Fields However, I can’t work out how I display that information to a user? At the moment, I’m using the following:
Which displays the info I need for one of my other fields, I just can’t work out how to display the multi-options in the select? Any help is much appreciated |
|
Posted: Saturday Feb 16th, 2013 at 2:24 pm #41958 | |
![]() |
|
It still doesn’t make sense, what does “multi-options” mean? You mean the dropdown fields? Also, your account is pro, it’s just beside your avatar. :) – Eduan |
|
Posted: Monday Feb 18th, 2013 at 3:23 am #42241 | |
|
|
Hi Eduan Yes the drop down with multiple select. How do I show the values on a page? Thanks |
|
Posted: Monday Feb 18th, 2013 at 10:11 am #42264 | |
![]() |
|
NOT sure if this would work, but you can try this:
Now, this works by using get_userdata(), one of WordPress’ functions. Again, not sure if this will work, I haven’t tested it myself but it’s worth a shot. Now, the s2Member way of getting the value of this field would be with the shortcode [s2Get user_field="custom_field" /], so to get this in code you would do something like:
Hope this gives you some clues. :) |
|
Posted: Monday Feb 18th, 2013 at 10:21 am #42268 | |
|
|
Thanks Eduan, I did as you said, swapping the custom_field to mine but to no avail:
I’ll play around with this but at the mo, it simply returns nothing Thanks though |
|
Posted: Monday Feb 18th, 2013 at 11:52 am #42281 | |
![]() |
|
I’m sorry it didn’t work. :( |
|
Posted: Monday Feb 18th, 2013 at 11:54 am #42283 | |
|
|
I think it’s because it stores the info as an array (due to being a multiple select). I’m not sure if that helps or not? Your help is much appreciated though! Thanks again |
|
Posted: Thursday Feb 21st, 2013 at 11:59 am #42741 | |
|
|
Sorry to post here again but I can’t seem to find a solution. I tried the following code:
This simply returns the entire contents of the array and not the selected values. I really can’t see why this is such an issue. It seems a shame that the multi select isn’t covered in the documentation like the standard custom fields Any help is much appreciated |
|
Posted: Thursday Feb 21st, 2013 at 2:28 pm #42749 | |
![]() |
|
Hmm… Personally I can’t help any more, so I’ll ask Jason for his help, see what he has to say. :) |
|
Posted: Friday Feb 22nd, 2013 at 6:20 am #42792 | |
|
|
Thanks Eduan I simply can’t find any info on this anywhere – surprisingly! So any assistance here would be awesome |
|
Posted: Friday Feb 22nd, 2013 at 9:32 am #42812 | |
![]() |
|
Thanks for the heads up on this thread :-)Please use s2Member® API Function: get_user_field() If the value is an array; you will get the array containing the selected values. |
|
Posted: Friday Feb 22nd, 2013 at 9:39 am #42815 | |
|
|
Hi Jason, Thanks for the reply. I’m a bit of a noob with PHP etc. Are you able to shed any light on code? The unique field ID is sector and it’s a multi select drop down. I just can’t seem to find code that’ll work. I’ve found code for checkboxes but trying to ‘adapt’ it simply didn’t work. Any help on this is very much appreciated! |
|
Posted: Friday Feb 22nd, 2013 at 11:00 pm #42895 | |
![]() |
|
Thanks for the follow-up :-)Here is a quick example:
Replace my_field_ID with the unique ID you assigned the Custom Registration/Profile Field in s2Member. |
|
Posted: Saturday Feb 23rd, 2013 at 6:34 am #42987 | |
|
|
Hi Jason, That is absolutely spot on – thank you!!!! |
This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.