Support Forum
We're using s2member on our eclass site for which I created a single custom profile field called 'Blog URL' in addition to the standard WP website field (user_url). Would it be possible to pull this field on to the SP profile so that students could edit it from there as well? It's a matter of keeping things in sync across their s2 member profile and SP profile.
Do you know where s2member stores this data? If it sticks rigidly to the WP API then it should store it in the usermeta table. And if it does that - and you do really need to check - then use our Custom profile fields plugin to create the SAME field and make sure the name is identical. Actually t is not the name it is the slug - make sure that you name it using the slug that s2member created.
If this woks then your data will be pulled into SP although you will have to add the field to the profile form if you want iti there. which is covered in the codex article for the custom fields plugin.
YELLOW
SWORDFISH
|
Thanks so much for the quick response. I had a look at the backend. While s2mmeber does store it's custom fields in usermeta it does so as an array, unfortunately. It's meta_key value is simply wp_s2member_custom_fields and then an array of all custom fields stored in meta_value. I think this option is not going to work.
OK - there are two parts to this and tonight I am just going to cover part 1 which is getting your sp2member data into the Simple:Press user object. I have not tried this but it should work...
Open up the spFunctions.php file of your Simple:Press theme (in the theme /templates folder) so you can make an edit. You can actually use the built in theme editor for this in the SP themes section of the admin.
At the bottom of the file - but before the closing php tag of course, copy and then paste in this code:
add_filter('sph_user_class_meta', 'add_my_field');
function add_my_field($list) {
$list['wp_s2member_custom_fields'] = '';
return $list;
}
first thing after you save this is to run a forum page to make sure you have got it all right!
Then next - go to the forum admin > Toolbox > Data Inspector and turn on the option to see 'spThisUser'. Next time you run a forum page you will see the SP user data object. You will be the only user to see it. Look down for the values of the custom fields to see if they have been included. They should be pretty near the top after the initial list of items.
YELLOW
SWORDFISH
|
Well - in the same /templates folder you will find two profile templates - one for the popup profile view and another when the profile is used as a page. You will only be using one of them.
If you take a few minutes to just scan through it you will see all the fields that are displayed on the popup or page - in sequence. So the first thing is to decide where you want to display your custom data. And the try to echo it out like this:
echo $spProfileUser->wp_s2member_custom_fields['blogurl'];
Of course you will probably want to style it and maybe show it in two columns like the current display and we can do that. First thing is to make sure it is working.
YELLOW
SWORDFISH
|
The awesome power of WordPress filters and the beauty of template driven displays. Now one last thing...
As always we recommend that you create your own SP theme so that any customisation is not lost during a future update. (http://codex.simple-press.com/.....g-a-theme/)
YELLOW
SWORDFISH
|
1 Guest(s)