• Hi there,

    I am in the process of switching to Stripe Integration and using subscriptions for the first time and I am getting a warning message in regards to my s2 hacks file. The line it is talking about is in there because with regular registrations (not subscriptions) I want the EOT date sent to Mail Chimp. I would assume this is happening because there is no EOT date with subscriptions? Thoughts on how to fix?

    This is the error message I get (it’s just at the top of the screen but registration seems to work properly).

    Warning: date() expects parameter 2 to be long, string given in /home/********/public_html/wp-content/mu-plugins/s2-hacks.php on line 8

    And this is my s2 hacks file…

    <?php
    add_filter('ws_plugin__s2member_mailchimp_merge_array', 'my_filter', 10, 2);
    function my_filter($merge, $vars) {
    	// $merge: Array of existing MERGE fields that s2Member passes by default.
    	// $vars:  Array of defined variables in the scope/context of this Filter.
    
    	$custom_merge = array(
    		'eot_date'   => date('m/d/Y',get_user_option('s2member_auto_eot_time', $vars['user_id']))
    	);
    
    	return array_merge($merge, $custom_merge);
    }
    
    /* Forces the default role of a new user to be set to "s2member Level 1" instead of "Subscriber" */
    add_filter("ws_plugin__s2member_force_default_role", "default_role",10,1);
    function default_role($role) {
    	$return = 's2member_level1';
    	return $return;
    }

    https://wordpress.org/plugins/s2member/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Set row 8 to:
    'eot_date' => date('m/d/Y', intval(get_user_option('s2member_auto_eot_time', $vars['user_id'])))

    This turns the value to integer number. Function date() should be happy…

    Thread Starter jaspud

    (@jaspud)

    Thanks. This definitely got rid of the warning. My one question, it does now send an EOT for subscriptions of 12/31/1969 and I am using automations with Mail Chimp to send renewal notices based on users EOT dates. We don’t want users that are active on subscriptions to be getting renewal notices and I’m not quite sure how Mail Chimp is going to treat this date (they may just ignore and not send it the automation; I have a support ticket in to ask them).

    If that is not the case, is there a way to have it send over EOTs for those with normal purchases and then nothing for subscription purchases?

    Thread Starter jaspud

    (@jaspud)

    Just an update,

    MailChimp’s response…

    In this case, it would be possible to segment subscribers so that only subscribers with a eot_date value occurring after 1/1/1970, or any date of your choice, would trigger the automation. In order to do this, it would be necessary to define a segment looking like this: [eot_date] [is after] [1/1/1970] The segment for an automation can be defined in the List and Workflow step of the Automation Builder.

    This works perfectly for what we’re trying to do.

    The only thing that doesn’t seem to work is that when a Stripe user cancels their subscription and they are given an EOT date, it does not update over to Mail Chimp (at least how I have it set up) but I actually don’t want it to so that’s all good.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error Warning During Stripe Purchase’ is closed to new replies.