latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Silent modifications to member profiles

Home Forums Community Forum Silent modifications to member profiles

This topic contains 3 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 1 month ago.

Topic Author Topic
Posted: Tuesday Nov 13th, 2012 at 1:09 pm #31464

Perhaps this is in the documentation somewhere, but I got a bit lost between the API section in the plugin and the codex.

We’d like to update some custom member profile fields with metadata when members view certain content on our site – e.g. to record the date they first visit a specific page, for example. Is that possible, and is there a ‘best’ way to approach coding what’s needed? Something like an ‘s2Set’ counterpart to the ‘s2Get’ shortcode, if such a thing exists? Or via javascript on the page?

Many thanks,

Andy.

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Tuesday Nov 13th, 2012 at 7:01 pm #31503
Eduan
Username: Eduan
Moderator

Hello Andy,

I’m afraid this is not part of s2Member’s functionality currently, you can however introduce some PHP in your post which does this, the WordPress way, which is not as simple as it would be with s2Member shortcodes.

You need a plugin like the PHP Execution plugin in order to introduce PHP in your posts.

– Eduan

Posted: Wednesday Nov 14th, 2012 at 6:41 am #31552

Thanks – I guess that would be doable. I also found this code from Raam – is that the kind of thing we’d need?

// Get an array of all the users' s2Member Custom Fields
$custom_fields = get_user_option("s2member_custom_fields");
// Set the value for a specific field ($custom_fields is an array)
$custom_fields["custom_field_name"] = $NewValue;
// Update the Custom Field data
update_user_option($user->ID, "s2member_custom_fields", $custom_fields);
Posted: Wednesday Nov 14th, 2012 at 9:12 am #31572

Yes, that approach can be used to edit the s2Member profile fields of a user.

Viewing 3 replies - 1 through 3 (of 3 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.