Page 1 of 1

Display custom profile fields?

PostPosted: January 21st, 2012, 4:04 am
by boldplans
SO I understand that we can set up profile fields for intake during the registration process and also when a user edits their S2M profile. But how can you display those fields on pages? For example, I have a field that displays a users Google Plus page. How can I simply retrieve a post author's entry for their Google Plus page? I don't see how to do this.

With Wordpress standard fields, this is much simpler. In fact, you can create additional profile fields by making an edit in the core Wordpress code (or use a plugin) and then when all the Authors of a site are output, the loop will be able to output all of their basic profile information (such as the basic AIM and Yahoo fields that are stock Wordpress.)

I only was able to find a convoluted hack which, if true, would make profile fields of limited value. While I like users to have a profile page, there is no way to have that same information appear in an author bio that appears on post pages. Hopefully all of this is not that difficult.

In addition - does S2 store IP Address information for each registered user such as the IP address they regiestered from? I see some indication in S2M that it does, perhaps storing it in each blog instead of once in the primary user table. It appears that Wordpress does not do this and it should for numerous reasons.

Re: Display custom profile fields?

PostPosted: January 23rd, 2012, 5:56 pm
by Raam Dev
Please see WP Admin -> s2Member -> API/Scripting -> s2Member PHP/API Constants -> S2MEMBER_CURRENT_USER_FIELDS. You can retrieve any of the custom fields through the examples shown there.

For example, to retrieve a custom field called googleplus, you might do this:

Code: Select all
<?php $fields json_decode(S2MEMBER_CURRENT_USER_FIELDStrue); ?>
<?php 
echo $fields["googleplus"]; ?>
This would output the value of the Custom Field 'googleplus'.

Re: Display custom profile fields?

PostPosted: January 23rd, 2012, 7:05 pm
by boldplans
Awesome Raam - thanks so much for the great support.

Re: Display custom profile fields?

PostPosted: January 24th, 2012, 11:58 pm
by Raam Dev
You're most welcome! :)