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.

About: Enrico Kabas

Sorry, I've not written a description yet. I'll get to it soon!


My Favorite Topics

Viewing topic 1 (of 1 total)
Topic Count Last Reply
Gift / Coupon Codes for s2member

By:  Angie Gonzalez in: Unofficial Extensions/Hacks

voices: 2
replies: 2

3 years, 10 months ago  Angie Gonzalez

Viewing topic 1 (of 1 total)

Topics I'm Subscribed To

Viewing 3 topics - 1 through 3 (of 3 total)
Topic Count Last Reply
limited Coupon-Codes for use xTimes only ….

By:  Enrico Kabas in: Community Forum

voices: 2
replies: 3

3 years, 1 month ago  Enrico Kabas

Two requests for future versions of s2member

By:  David Sprunger in: Community Forum

voices: 2
replies: 1

3 years, 1 month ago  Enrico Kabas

What should i insert in the "my-cron-job.php"

By:  Enrico Kabas in: Community Forum

voices: 2
replies: 1

3 years, 9 months ago  Bruce

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

Topics I've Started

Viewing 2 topics - 1 through 2 (of 2 total)
Topic Count Last Reply
limited Coupon-Codes for use xTimes only ….

By:  Enrico Kabas in: Community Forum

voices: 2
replies: 3

3 years, 1 month ago  Enrico Kabas

What should i insert in the "my-cron-job.php"

By:  Enrico Kabas in: Community Forum

voices: 2
replies: 1

3 years, 9 months ago  Bruce

Viewing 2 topics - 1 through 2 (of 2 total)

My Latest Replies (From Various Topics)

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Sunday Dec 8th, 2013 at 5:03 pm #61767
Enrico Kabas
Username: Enrico

Ok, Point 2 should be ok !

I added following code to “s2hacks.php” in the “/wp-content/mu-plugins” folder ……

But, what is to do with Point 3 ?

function FJ_Activate_Coupon($userID, $RoleStr, $RoleB = true) { // userID is the current user redeeming the coupon, RoleStr is what you want to update, and RoleB is a boolean for updating user role or custom capability.

$user = new WP_User($userID); // create a User Object

if ($user->role[0]!=”administrator”) {
/* Modifies custom registration fields (useful when the field you want to update is present at registration)
$custom_fields = get_user_option(“s2member_custom_fields”);
$custom_fields[“coupon_id”] = $CouponID;
update_user_option($user->ID, “s2member_custom_fields”, $custom_fields);
*/
if ($RoleB === true) { //modify user role
// This can only modify 1 role or capability at a tiem. You need to run the funcion with 1 parameter.
$user->set_role($RoleStr); // subscriber, or s2member_level[1 2,3,4]
}
else { //modify custom capability
$user->add_cap(“access_s2member_ccap_”.$RoleStr ); // adds custom capability
}
$expire_on = strtotime(“+2 years”); // establish the EOT for the role
update_user_option ($user->ID, “s2member_auto_eot_time”, $expire_on);
//return “ID: “.$user->ID.” Update: “.$user->roles[0].” Bool: “.$RoleB; // Ignore: lines I used for testing
} else {
//return “No ha corrido el codigo porque eres Admin”; // Ignore: lines I used for testing
}
}

Posted: Sunday Dec 1st, 2013 at 5:37 am #61546
Enrico Kabas
Username: Enrico

Hi !

Please add also “Coupon Codes expiring after use” to next updates ….

Thanks,
Enrico

Posted: Sunday Dec 1st, 2013 at 5:31 am #61545
Enrico Kabas
Username: Enrico

Hello !

No ideas ?

Viewing 3 replies - 1 through 3 (of 3 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.