Home › Forums › Community Forum › Get custom profile field values
This topic contains 13 replies, has 3 voices. Last updated by Cristián Lávaque 4 years, 9 months ago.
| Topic Author | Topic |
|---|---|
| Posted: Monday Apr 9th, 2012 at 10:51 am #10358 | |
|
|
|
|
Augh, help I have spent hours trawling the S2 support forums and Codex for an answer but my head is hurting a great deal now. I am trying to create front-end user Profiles (not editable) read-only – so other members can view a members key profile data. I am editing a WP theme template (author.php), adding custom php code to get profile data for a specific user (passed as a GET parameter – /?author=6) I need to get s2member custom profile field data and print it into the page – some of the custom fields are multi-option checkboxes. Can anyone give me the code to do this ? Thanks joe |
|
List Of Topic Replies
| Author | Replies |
|---|---|
| Author | Replies |
| Posted: Monday Apr 9th, 2012 at 5:01 pm #10376 | |
|
|
|
|
bump |
|
| Posted: Monday Apr 9th, 2012 at 5:44 pm #10389 | |
![]() |
|
|
Hi Simon, Extracting s2Member Custom Profile Field data via PHP is possible, but it’s not going to be pretty. Please see this thread for more information. |
|
| Posted: Monday Apr 9th, 2012 at 6:17 pm #10392 | |
|
|
|
|
Thanks Raam I had already read that thread – its not really aimed at what I am trying to achieve Or, to put it another way, it relates to a method of searching users for custom fields and I am not clever enough to work out how to extract from it the information I need to: Print/echo data from user meta fields (using an author ID) I have tried this: (it breaks the page) and this: (it returns ‘Array’) buyer_country_usa is a multi-option checkbox field Cheers Joe |
|
| Posted: Monday Apr 9th, 2012 at 6:20 pm #10393 | |
|
|
|
|
oops first code snippet:
second code snippet:
ps – I have an unusual database table prefix |
|
| Posted: Monday Apr 9th, 2012 at 6:41 pm #10399 | |
![]() |
|
|
Hi Simon, I understand the frustration in working with the Custom Registration field data within the database and we’re working to improve the way that information is stored in future versions. As per our support policy, we unfortunately cannot assist with custom coding (please see s2Member® » Support Policy » Outside Scope). If you’re not comfortable working with PHP, we recommend hiring a PHP developer via jobs.wordpress.net. |
|
| Posted: Monday Apr 9th, 2012 at 6:53 pm #10401 | |
|
|
|
|
I understand but if you keep user meta data in a serialised array you could help me to extract that data in a meaningful way – that’s after all, at least partly what the support forums are about…no ? I have posted some custom code that has made an attempt to get the data I need but is clearly not the full solution. What I am asking for is help completing what I have attempted to start myself. This is consistent with other posts where users have subsequently had a good level of support for their custom coding. If you don’t want to help me can you ask Jason to post me an answer, as I am not aware that an answer to this specific question exists anywhere at this time in your support forums. If it does, simply point me to it Thanks |
|
| Posted: Tuesday Apr 10th, 2012 at 2:14 am #10430 | |
|
|
|
|
Simon, this function I wrote some time ago may help you displaying the s2Member custom fields. http://www.primothemes.com/forums/viewtopic.php?p=16582#p16582 I hope it helps. :) |
|
| Posted: Tuesday Apr 10th, 2012 at 3:46 am #10437 | |
|
|
|
|
That’s awesome, thanks Cristian. Well what do you know: A) the info already existed cheers – I’ll post something back when I have a working solution |
|
| Posted: Tuesday Apr 10th, 2012 at 4:48 am #10439 | |
|
|
|
|
Glad it helped. :) Yeah, the custom fields can be a bit frustrating when you start using them in PHP, since they’re in a serialized array. We’re aware that it’s not optimum and we’ll have this solved soon with the coming major update of the plugin. |
|
| Posted: Tuesday Apr 10th, 2012 at 4:52 am #10440 | |
|
|
|
|
By the way, I just remembered having seen a function in the codex that’d do something similar, and it has the same name as the function I posted last year. Jason told me he had added it to s2Member, but I had forgotten. Please read about it here and play with it to see what the output is like: |
|
| Posted: Tuesday Apr 10th, 2012 at 5:13 am #10444 | |
|
|
|
|
Cristian, is there a bug in this code – it causes my page to go blank when I include it like this (with a user ID)
|
|
| Posted: Tuesday Apr 10th, 2012 at 7:03 am #10447 | |
|
|
|
|
This is what I have in my author.php (gives me a blank page)
|
|
| Posted: Tuesday Apr 10th, 2012 at 2:45 pm #10487 | |
|
|
|
|
It’s probably a PHP error because of the existing function with the same name that I linked to in my last post. Try using the function already in s2Member or, if you prefer the one I wrote, give it unique name. That should do it. |
|
This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.








Pre-Sale FAQs
Video Tutorials
Community Forum
Knowledge Base
News/Updates
s2 Codex / Docs
GPL v2 License
Contact A Human
About Us
Our Customers
Support Policy
Privacy Policy

