Support Forum

Getting User Registration Data From S2Member To Show Up In Simple:Press

JB Justin Buehler
Justin Buehler
Member

Hello:

 

I’m trying to get some of the data collected in my S2member registration form to show up on users’ profiles in Simple:Press 5.0. How would I do that? I’m seeing users’ usernames, and first and last names in Simple:press, but not any other data collected.

This may not have anything to do with my problem, but just for the record: I’ve activated the Simple:Press Custom Profile plug-in, and created a new field. However, that custom field is not showing up either.

Let me know what you need, such as login info, and I’ll send it to you.

 

Thanks.

15 Answers

New Answer

MP Mr Papa
Mr Papa
Member

that plugin would have to provide a method for accessing its data…

the custom profile field plugin wont do what you want… its for adding new forms to the sp profile for users to fill in… it wont pull existing data from other locations… how could it possibly know how?

If you used the custom profile field for new data, you need to put the template tag where you want it to display…  again, we couldnt possible begin to know where you want to display the data…  we put the input parts on the edit profile form for users to add their data, but its up to you to use the template tag to display the info where you want…

The protoype for displaying a tag is:

sp_CustomProfileFieldsDisplay($name, $userid=0)

where you pass the field name (see the admin profile panel where you named it) for $name and pass the user id in $userid for the user whose info you want to display… leave it blank if you want the current user…

alternatively, if you want to just grab the data for the current user, you can get it at $spThisUser->field_slug, where field_slug is the slug of the custom profile field (again visible on the admin form)…  or if you have a sp user object, such as the profile user ($spProfileUser) or post user ($spThisPostUser) object, you can get at it similarly…

or use the user object to pass in the id to the template tag…

you can see more on this here:  https://simple-press.com/support-forum/sp5-plugin-topics/custom-profile-field-1/page-2/

JB Justin Buehler
Justin Buehler
Member

Hi Mr. Papa,

 

So, I went to S2member’s forum and told that developer I needed a method for accessing the S2member data…

This is what I got back:

“You can get most if not all of your user details through pre-defined tags like:

[s2Get constant=”S2MEMBER_CURRENT_USER_DISPLAY_NAME” /]
S2MEMBER_CURRENT_USER_FIRST_NAME
S2MEMBER_CURRENT_USER_LAST_NAME
S2MEMBER_CURRENT_USER_ID
S2MEMBER_CURRENT_USER_LOGIN
S2MEMBER_CURRENT_USER_EMAIL

etc.

Not sure how you need to use it but there you go. You can also access the constants via php like so:

 
<?php echo S2MEMBER_CURRENT_USER_EMAIL; ?>

 

EDIT: This also works with custom registration fields I believe.”

 

So, I tried to use the above tags in the spProfileShow.php template in the Simple:Press Theme Editor. However, it kept coming up with errors. I suspect I’m not putting the tags in the template properly, or something is missing, as I’m still learning .php. Could you show me where in the spProfileShow.php template the tags should go, and anything else I’m missing?

 

Thank you so much. I think I’m close to the getting the custom profile fields in S2member to show up in the Simple:Press user profiles.

MP Mr Papa
Mr Papa
Member

not sure what you are trying to do…  are you trying to output some of the s2member data on the profile page or popup?

you wouldnt need the custom profile field plugin for that….  but suspect you are trying to do 2 things here…

so to display s2 data in the profile page (not edit form) or popup, yes, edit the template file in the sp theme you are using…  and do something like

do_shortcode('[s2Get constant="S2MEMBER_CURRENT_USER_EMAIL" /]')

if you want different data, just change the string for constant to be the one you want…

JB Justin Buehler
Justin Buehler
Member

“not sure what you are trying to do…  are you trying to output some of the s2member data on the profile page or popup?”

Yes, output in the popup in Simple:Press.

 

Note: I realize I wouldn’t need the custom profile plugin in for Simple:Press. Thank you for pointing that out.

 

“so to display s2 data in the profile page (not edit form) or popup, yes, edit the template file in the sp theme you are using…  and do something like


shortcode(‘[s2Get constant=”S2MEMBER_CURRENT_USER_EMAIL” /]’)
 

if you want different data, just change the string for constant to be the one you want…”

 

What is the template called (I’m not sure of it’s name) to make it show up in a popup of the user’s Simple:Press profile? Where in the popup code do I insert the above tag?

And do I include all of this exactly as it’s typed: shortcode(‘[s2Get constant=”S2MEMBER_CURRENT_USER_EMAIL” /]’)

I inserted [s2Get constant=”S2MEMBER_CURRENT_USER_EMAIL” /] just exactly as it’s typed before, but it came up with an error.

 

Thank you for all of your help.laugh

MP Mr Papa
Mr Papa
Member

your code does not match mine…

the function call should be do_shortcode

please use that… and if you still get errors, please paste exactly your code plus a couple lines above and below the line…

JB Justin Buehler
Justin Buehler
Member

After pasting do_shortcode(‘[s2Get constant=”S2MEMBER_CURRENT_USER_EMAIL” /]’), I keep getting errors like this one:

 

Parse error: syntax error, unexpected T_STRING in /problem-with-post-edit-buttonome/problem-with-post-edit-buttonazbro/public_html/oddhoursnews.com/wp-content/sp-resources/forum-themes/default/templates/spProfileShow.php on line 35

MP Mr Papa
Mr Papa
Member

do you have a semicolor (ie 😉 at the end of the line?

JB Justin Buehler
Justin Buehler
Member

No, I didn’t have a semi-colon. When I added it, the error message went away, but the data is still not showing up. frown

 

Am I putting the tag in the right place on the spProfile.php template?

 

# show profile info

            sp_ColumnStart(‘tagClass=spProfileShowInfoSection spRight&width=65%’, ‘profileInfo’);
                sp_ProfileShowDisplayName(”, __sp(‘Username’));
                sp_ProfileShowFirstName(”, __sp(‘First Name’));
                sp_ProfileShowLastName(”, __sp(‘Last Name’));
                sp_ProfileShowLocation(”, __sp(‘Location’));
                sp_ProfileShowWebsite(”, __sp(‘Website’));
                sp_ProfileShowBio(”, __sp(‘Bio’));

do_shortcode(‘[s2Get constant=”S2MEMBER_CURRENT_USER_EMAIL” /]’);

            sp_ColumnEnd(”, ‘profileInfo’);
        sp_SectionEnd(‘tagClass=spClear’, ‘profileBasic’);

MP Mr Papa
Mr Papa
Member

well, now you are running into needing to know what s2 member is doing…  going to be hard to help without knowing s2 member…

but yes, that location is fine…

maybe that shortcode only returns data…  so you could try:

echo do_shortcode('[s2Get constant="S2MEMBER_CURRENT_USER_EMAIL" /]');
JB Justin Buehler
Justin Buehler
Member

Hi Mr. Papa:

 

I added the “echo” in front of “do_shortcode(‘[s2Get constant=”S2MEMBER_CURRENT_USER_EMAIL” /]’);” and that worked. The profile field from S2member is now showing up in the profile section of Simple:Press.

 

The problem now is the shortcode is showing the “current user’s” data for ALL of the users. I want to have each user’s data from S2member show up in their individual Simple:Press profile.

 

Is there a way to do this?

 

Thanks.

YS Yellow Swordfish
Yellow Swordfish
Member

You will need to ask the S2member team if they have a similar shortcode or tag that can have a user id passed so that it returns that users data…