This topic contains 21 replies, has 16 voices. Last updated by Kristen Symonds 2 years, 11 months ago.
Topic Author | Topic |
---|---|
Posted: Wednesday Nov 7th, 2012 at 11:08 pm #30985 | |
Hack Description
If you're looking for a way to notify users their EOT date is coming up, or that they have reached their EOT date, this can be done fairly easily with a few lines of code and the use of the WordPress function Hack InstructionsDepending on what functionality you're looking for, this hack takes either 1 or 2 steps. If you're looking to notify users of an upcoming EOT date, you need to check out the functions outlined below. One of the below functions sets the EOT Notification date, and the other tells users when they are getting close to their EOT through the EOT Notification date. If you're looking to simply send an email, or notify the user when they have reached their EOT date, the approach is much simpler. Notify Users of an Upcoming EOT Date
When notifying users of an upcoming EOT date, you need to set up 2 functions to get this functionality. The first being a way to add a User Meta value for each user that has an EOT date based on the s2Member user meta value
$wpdb->prefix.'s2member_auto_eot_time' .
These functions (which we have named Set Notification TimestampAfter we've created our Must Use plugin, the first function we want to create is This version of this function sets up the Notification EOT date as 1 week before s2Member Automatically demotes/deletes the member. If you'd like to change the amount of time the user has, you can change the variable
Set Up the Notification FunctionAfter we've set up the Notification EOT Times, we can then use these times to Notify Users. Within the above function we also set up a WP_Cron event. We'll use this event to notify users (Notice that this function doesn't do anything really other than delete the User Meta value as of yet. You can use wp_mail() within this function to notify users):
Tip: These functions are only to point you in the right direction. These functions as they are now will not function correctly. If you cannot set up your notifications, we recommend getting a Freelance developer to help you out, or creating a Forum topic (or both!). :-) Notify Users They Have Reached their EOT Date
Notifying users when they reach their EOT date is much simpler. The way you would need to do this is to simply hook into the s2Member action hook
ws_plugin__s2member_during_auto_eot_system_during_demote , and extract() the variables s2Member was using:
Tip: this function is only meant to point you in the right direction. You still need to change this function to suit your WordPress installation. If you cannot set up your notifications, we recommend getting a Freelance developer to help you out, or creating a Forum topic (or both!). :-) |