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.

eBierek


My Latest Replies (From Various Topics)

Viewing 25 replies - 1 through 25 (of 39 total)
Author Replies
Author Replies
Posted: Monday Oct 28th, 2013 at 11:04 am #60685
eBierek
Username: eBierek

This is now sorted out. If anyone else stumbles on this problem it happened because the primary Paypal e-mail address was changed. The one used with API-settings in s2member.

I don’t know whether the Paypal login e-mail address and the primary Paypal account e-mail address needs to be the same? Does anybody know this?

Posted: Thursday Apr 4th, 2013 at 2:21 pm #46627
eBierek
Username: eBierek

@Rick: Sure :)
It’s working for new members and renewing members but demoted members which have to upgrade from level 0 to 1 seems difficult to solve.

Posted: Wednesday Apr 3rd, 2013 at 3:57 am #46451
eBierek
Username: eBierek

Ok, thank you for all the help :)

Posted: Thursday Mar 28th, 2013 at 1:12 pm #45985
eBierek
Username: eBierek

Is there a way I can split these roles up (by hook), just as Cristián suggested for the new users?

This should catch existing users when they renew their active account, and sets EOT to current year+1/12/31

add_action (" ? ", "my_fixed_EOT_time_upd");
function my_fixed_EOT_time_upd ($vars)
{	
$expire_on = strtotime((date('Y') + 1) . '-12-31');
update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
}

This should catch demoted users when they decide to pay, and upgrades from level 0 to 1, and sets EOT to current year/12/31

add_action (" ? ", "my_fixed_EOT_time_upg");
function my_fixed_EOT_time_upg ($vars)
{	
$expire_on = strtotime ( date('Y') . '-12-31');
update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
}
Posted: Thursday Mar 28th, 2013 at 12:04 pm #45981
eBierek
Username: eBierek

This also returns EOT as “todays date + one year”, not “current year+1/12/31” as desired.

Posted: Thursday Mar 28th, 2013 at 11:42 am #45979
eBierek
Username: eBierek

Hi,

I’m sorry to say this doesn’t work either.

add_action ("ws_plugin__s2member_during_paypal_notify_during_before_subscr_modify", "my_fixed_EOT_time_upd");
add_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_signup_w_update_vars", "my_fixed_EOT_time_upd");

function my_fixed_EOT_time_upd ($vars)
{	
	//If user is demoted to subrsciber
	if (user_is($vars["user_id"], 'subscriber')) { 
		$expire_on = strtotime ( date('Y') . '-12-31');
		update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
	//elseif user is renewing active membership
	} else { 
		$expire_on = strtotime((date('Y') + 1) . '-12-31');
		update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
	} 
}

It still gives me (date(‘Y’) + 1) even if the user is a ‘subscriber’ (demoted). What can I use here? Many thanks.

Posted: Sunday Mar 24th, 2013 at 10:15 am #45587
eBierek
Username: eBierek

Hi Bruce, thanks for helping :)

I have tried this and it still gives me (date(‘Y’) + 1) even if the user is a “subscriber”. Where in the process, is EOT set/updated? Has the user role already changed from “subscriber” to “level1-user” at that time?

Posted: Thursday Mar 21st, 2013 at 5:27 am #45314
eBierek
Username: eBierek

Since a demoted user still is considered to be a “user that will updated” I need to work with these, right?:

add_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars", "my_fixed_EOT_time_upd");
add_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_modify", "my_fixed_EOT_time_upd");

That also handles change for other users (level1-3). So I tried following:

function my_fixed_EOT_time_upd ($vars)
{
	if (current_user_is("s2member_level0")){ 
		$expire_on = strtotime ( date('Y') . '-12-31');
		update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
	
	} else { 
		$expire_on = strtotime((date('Y') + 1) . '-12-31');
		update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
	} 
}

This still gives me “current year + one year” even if the user is demoted (level0). Maybe the hooks cant handle conditions? Do you know of others that have tried this?

Posted: Thursday Mar 21st, 2013 at 4:17 am #45308
eBierek
Username: eBierek

Thanks, I will try that :)

Posted: Wednesday Mar 20th, 2013 at 2:30 pm #45244
eBierek
Username: eBierek

Hi and thank you for trying to help :)

I have now two functions as you suggested. One for new members setting EOT to “current year-12-31” and one for members updating their account setting EOT to “(current year+1)-12-31”. This works great!

But we also need to handle demoted users. When they decides to finally pay again, their EOT should be set to the same as new users -> “current year-12-31”. Can we handle them with another hook? Right now they get one year too much. Advice much appreciated.
/Emily

Posted: Tuesday Mar 19th, 2013 at 8:52 am #45164
eBierek
Username: eBierek

Hello again,
Thank you for feedback.

Sorry if I confused you. Users account is the same all the time, we don’t have upgrades between levels unless a user is demoted for not paying on time.

So the senario is: Level 1 user logs in (I know for sure the level is right), it’s march 2013 (EOT currently set to 2013-12-31). During the month of march all members can renew their membership for upcoming year. When user does that/pays for another year, EOT should be set to 2014-12-31 (get current year and add one). And there is where it all fails, as the new EOT isn’t saved.

Payment with PayPal works and is registered, receipt is sent out from PayPal/S2, and Paid Subscr. ID is also updated.

What could be missing?

Posted: Thursday Mar 14th, 2013 at 12:35 pm #44630
eBierek
Username: eBierek

Hello again,

Setting EOT with conditionals works for new members and demoted members (level0) where EOT is empty. I have tested accounts logged in on level 1-3, no EOT update. But when I do following, without the (current_user_is(“s2member_level2”))-conditionals it works fine:

function my_fixed_EOT_time ($vars) {
$expire_on = strtotime((date('Y') + 1) . '-12-31');
update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);	
}

This is confusing. Is this a bug?

Posted: Thursday Mar 14th, 2013 at 7:48 am #44593
eBierek
Username: eBierek
function my_fixed_EOT_time ($vars) {
	if (current_user_is("s2member_level2")){ 
		$date =  date('Y') . '-12-31'; //get current year and adds -12-31
		$expire_on = strtotime ( '+1 year' , strtotime ( $date ) ) ; //add one year to current year
		update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);	
	}
}

This returns the right time, 1420002000 (unix time stamp) which is “Wed, 31 Dec 2014 05:00:00 GMT”. What am I missing? :) Unix time stamp is the right format for updating EOT, right?

Posted: Wednesday Mar 13th, 2013 at 11:13 am #44494
eBierek
Username: eBierek

Ok, I have tested alot and this works, it updates EOT:

function my_fixed_EOT_time ($vars) {
$date =  date('Y') . '-12-31'; //get current year and adds -12-31
$expire_on = strtotime ( '+1 year' , strtotime ( $date ) ) ; //add one year to current year
update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);	
}

But when I add the conditionals for different levels, it doesn’t work. Can’t I use

else if (current_user_is("s2member_level2")) {some code to add EOT}

in s2hacks.php? See first post for reference.

Posted: Wednesday Mar 13th, 2013 at 6:41 am #44474
eBierek
Username: eBierek

Hi Cristián,

Thank you for helping. I’m using the pro paypal forms for level #X, one year access. I tried your suggestion with the code below but nothing happens unfortunately.

else if (current_user_is("s2member_level1")){ 
$expire_on = "2020-12-31";
update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);	
}

I also tested the date for new users, setting it to a fixed date of “2020-12-31” but that gives me an EOT of “Thu Jan 01st, 1970”. Why is that?

else { 
$expire_on = "2020-12-31";
update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
} 

What could be wrong?

Is it

get_user_field('s2member_auto_eot_time'))) + 1 year

you mean? :) How would I do that if user is level 1-3?

Posted: Tuesday Jan 8th, 2013 at 5:54 am #36561
eBierek
Username: eBierek

Hi and thank you for answering :)

No need to use a hacks file. You can have a page accessible to Level 1 users (assuming that’s the paid access you sold), so only them would see this page. And in it you’d have a condition that checks the month and shows the renewal pro-form during November and December only.

But the EOT-code for renewal/upgrade must be in the s2hacks file, no?

Sorry if the questions are confusing.

Posted: Thursday Jan 3rd, 2013 at 7:38 am #36099
eBierek
Username: eBierek

Hello again,

Here are some more info:
The regular pro-forum will be available all year around for new members. Sets EOT to ‘current-year/12/31’.

The renewal pro-form will be available say during november-december only and only for current members.
Must set EOT to ‘current-year+1/12/31’.

So the forms will, at some point, be avaliable at the same time. Are there different hooks to use in the s2hacks-file for the renewal form, for setting the right form of EOT? Would it be a good idea to check if user is loged in and if month nov-dec then show the renewal form?

Then it’s the third option, when a member don’t/ forgets to renew and gets demoted – then we need the upgrade pro-form/button or something similar? Does upgrades work differently?

Thanks in advance
Emily

Posted: Thursday Dec 27th, 2012 at 8:21 am #35539
eBierek
Username: eBierek

Hi Eduan,

Thank you for advice. I have now tried removing mu-plugins, switching to another theme (2012), deactivating all other plugins but S2Member and the error still remains.

To make sure no custom code is interfering I installed a completely new WP 3.5 and downloaded lastest S2M and only this in the setup causes problems. Unfortunately.

First error after install:

Second error efter just klicking the plugin tab once:

The same errors appear with theme 2011 and 2012. Deactivating S2M also removes the errors. Is this a bug?

Posted: Thursday Dec 20th, 2012 at 3:45 pm #35188
eBierek
Username: eBierek

Do you mean the same form that new members use to register or a completely new form? Since this time, the EOT should be set to ‘current-year+1/12/31′ instead of ‘current-year/12/31′.

Posted: Wednesday Dec 19th, 2012 at 2:54 pm #35085
eBierek
Username: eBierek

Hi again,

Thanks for the advice. This works great. When a new member registers, EOT is set to ‘current-year/12/31’.

Question for next step:
During the period of november 1st – 30th every year existing and logged in members can renew their membership. (I’m thinking they would access a renew-page in member menu.)

Then EOT should be set to ‘current-year+1/12/31’, but what would be the best method to do that? Another form? Paypal button (using paypal express checkout)? Are there hooks for renewals?

(After ‘current-year/12/31’ has passed, non paid members gets demoted, and can only see an upgrade page if they try to log in.)

Posted: Wednesday Dec 19th, 2012 at 2:32 pm #35083
eBierek
Username: eBierek

Thank you for explaining :)

Posted: Tuesday Dec 18th, 2012 at 10:19 am #34940
eBierek
Username: eBierek

Thank you, that seems to work. Could you explain the difference please?

Posted: Monday Dec 17th, 2012 at 8:11 pm #34874
eBierek
Username: eBierek

Hi again,

Do you have the fields First name, last name and E-mail address in your MailChimp list? Have you modified them?
By default, s2Member sends a merge array with the following associative array.

'MERGE0' => '[ EMAIL ]', 
'MERGE1' => '[ FIRST NAME ]', 
'MERGE2' => '[ LAST NAME ]',

My whole working code is:

add_filter("ws_plugin__s2member_mailchimp_double_optin", "__return_false");
add_filter('ws_plugin__s2member_mailchimp_merge_array', 'mailchimp_merge', 10, 2);
function mailchimp_merge($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. */

        //print_r($vars); // Lots of good stuff in this array.
		$user_id = $vars['user_id'];
		$cfields = get_user_option('wp_s2member_custom_fields', $user_id);

		return array_merge($merge, array(
			'USER_ID' => $user_id, 
			'MERGE4' => $cfields['member_industry'] (skip this row?)
			));
    }

You might try skip the custom fields, but I believe you still have to merge over the 3 fields you’re talking about to MailChimp? I’m adding all members by form though, not manually.

Posted: Monday Dec 17th, 2012 at 1:04 pm #34853
eBierek
Username: eBierek

Hi William,

Maybe this can help you on the way.

I’m using the code from this page http://www.s2member.com/forums/topic/mailchimp-integration-custom-merge-fields and that works perfectly when new members use the register/paying form.

Code goes into s2hacks.php, and then be sure to match the s2member fields with the ones you have in MailChimp.

ex. 
	return array_merge($merge, array(
			'USER_ID' => $user_id, 
			'MERGE4' => $cfields['member_industry'], 
			'MERGE5' => $cfields['member_profession'], 
			'MERGE7' => $cfields['member_city']  

Merge# is the fields from MailChimp and the ones on the right are S2M fields, created in General options > Custom Registration/Profile Fields.

/Emily

Posted: Thursday Dec 13th, 2012 at 5:32 pm #34487
eBierek
Username: eBierek

Hi Bruce,

Thank you!

Viewing 25 replies - 1 through 25 (of 39 total)

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.