[s2Get user_field="my_field" /] stopped working

Hello,

I am new to s2 member (pro), I generally like it. I have just upgraded to v241216 (Framework and Pro) from v241114 (Framework and Pro) and none of my [s2Get user_field=“my_field” /] short codes now work? Anyone else have this problem?

Thanks in advance,
Rob

Thanks for reporting that, Rob!

I’ll take a look at it to fix it in the next release. You can use the previous version in the meantime if you want.

:slight_smile:

yes, this has stopped for me as well.

Till it gets properly fixed this does the same job

function s2GetPro_shortcode($atts) {
	$atts = shortcode_atts(array(
		'user_field' => ''
	), $atts);

	$user_id = get_current_user_id();
	$custom_fields = get_user_option('s2member_custom_fields', $user_id);

	return $custom_fields[$atts['user_field']];
}
add_shortcode('s2GetPro', 's2GetPro_shortcode');
1 Like

I sent you a few private messages during the past couple of months but I am unsure if you’re reading them.

I was unable to email you as well.

Just letting you know in case you’re unaware.

If I don’t get an answer I will assume it’s intentional and I won’t waste my time here.

1 Like

Hi Sim! Wasn’t intentional. I’ll look for them now.

1 Like

Nice, Gerard. :slight_smile:

I’ll improve this in the next release.

1 Like

Rob and Gerard, I made a release today that includes a fix for the custom fields in s2Get. https://s2member.com/s2member-v250214-now-available/

:slight_smile:

1 Like

I just experienced a similar problem. Reporting here because the code here fixed it for me.

  1. User visits a page that displays a custom profile field using S2get
  2. User updates custom profile field using the profile page
  3. User revisits page that displays a custom profile field using S2get
  4. The page displays the old data
  5. User revisits the profile edit page and it displays the updated data (and so does the admin page)

First I thought this had to do with moving to a new host and caching because it was reported by a user days after a host move, but I was able to replicate on a local install with no caching. I tried downgrading to the last few s2 versions along with a random one from 2023 and still experienced the error.

I put Gerard’s code into my theme functions.php file and changed the custom profile field s2gets to that one and it worked as expected. Note, though, that it only worked with the custom fields. Using the new shortcode on non-custom fields gave blank responses. So what’s currently working is s2Get for the native fields and s2GetPro for the custom ones.