• Resolved 2cats

    (@2cats)


    Hi, I’ve been successfully using the following code to translate s2Member’s EOT time to something readable:

    if (!function_exists('ausers_format_s2member_auto_eot_time')) {
    	function ausers_format_s2member_auto_eot_time($v, $u) {
    		return ausers_format_unix_timestamp($v);
    	}
    }
    if (!function_exists('ausers_format_unix_timestamp')) {
    	function ausers_format_unix_timestamp($v) {
    		if (empty($v)) return('');
    		return (date ('Y-M-d', (int) $v));
    	}
    }

    Now it no longer works. I am using v141007 of s2Member, don’t know if an upgrade broke this function. I tried adding the wp_ table prefix per this post: https://wordpress.org/support/topic/formatting-fields-now-requires-wp-table-prefix?replies=7 but that did not work either. Any help would be sincerely appreciated as this is a crucial function for some reports we are running.

    https://wordpress.org/plugins/amr-users/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter 2cats

    (@2cats)

    I should add that although the text export option appears at the top of the list display:
    CSV Export |Txt Export | Configure this list | Edit headings | etc.

    when we go to export we only get the CSV option: Public user list csv file with a download link, the text option has disappeared.

    Plugin Author anmari

    (@anmari)

    Hi – I’ll have a look into it.

    Plugin Author anmari

    (@anmari)

    Actually – could you export from your user-meta (not the users), a representative set of S2 member data – not ALL your usermeta, else the file will get too big.

    Worst case just email me some of the serialised data fields.

    always better to have a range of real data and I don’t actually use S2member myself 🙂

    anmari@anmari.com

    Plugin Author anmari

    (@anmari)

    HI, I think this came up some where before. It seems that their data is (now?) stored with the site prefix in the meta key. ‘prefix_s2member…’ etc.

    So if one moves one’s custom code and the site prefix is different, the code would not work.

    The sample code that I had for S2member got around this by using a filter instead and checking for the non-prefix part of the metakey so that it would work on any site.

    Change your function name to
    ausers_format_prefix_s2member_auto_eot_time
    where prefix is that sites prefix it should work.

    I’ll have an update of the sample code up soon with a few extra items.

    Thread Starter 2cats

    (@2cats)

    Hi anmari, Thank you for your quick response. So I have tried this:

    if (!function_exists('ausers_format_wp_s2member_auto_eot_time')) {
    	function ausers_format_wp_s2member_auto_eot_time($v, $u) {
    		return ausers_format_unix_timestamp($v);
    	}
    }
    if (!function_exists('ausers_format_unix_timestamp')) {
    	function ausers_format_unix_timestamp($v) {
    		if (empty($v)) return('');
    		return (date ('Y-M-d', (int) $v));
    	}
    }

    but still no luck. I checked the database and the field title is “wp_s2member_auto_eot_time”. Surprisingly somehow the text export is now working — but still with the Unix datestamp. Thank you again!

    Plugin Author anmari

    (@anmari)

    HI, I’ve updated this
    http://wpusersplugin.com/downloads/amr-users-plus-s2-member/
    and the date/time formatting is all working nicely for me as you can see from the screenshot.

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

The topic ‘Formatting fields: s2Member EOT field’ is closed to new replies.