In my Hide Inactive Sites plugin I’ve added several filters to manipulate the data. You can modify the emails sent to the end users and edit the times available in the plugin settings. I thought it might be helpful to show how to change some of these that may want to do so.
Note: please never edit the plugin code directly! You are best off creating your own plugin or putting code in your theme’s functions.php file.
Let’s say that I want to warn my users that their site will be hidden if they haven’t updated it in 2 days. Well, by default, the plugin doesn’t offer you the option to warn in 2 days. It allows you to warn after 1 day of inactivity. One week is the next closest time to warn a user of inactivity. So, let’s add an option for “2 days”:
function add_inactivity_warning_threshold($inactivity_warning_thresholds){
$inactivity_warning_thresholds[60*60*24*2] = __('2 Days');
return $inactivity_warning_thresholds;
}
add_filter('hide-inactive-sites-manage-inactivity-warning-thresholds', 'add_inactivity_warning_threshold', 1, 1);
Ok, how about another example? Let’s edit the text sent in the email when a site is hidden:
function edit_hidden_email_message($message, $site_details){
$message = '';
$message .= 'Hey admin, your site is no longer available! You should probably have updated it more often!
';
$message .= '';
}
add_filter('hide_inactive_sites_edit_site_hidden_message', 'edit_hidden_email_message', 1, 2);
Other Filters Available
Site Hidden Email
- Edit list of email recipients: hide_inactive_sites_edit_site_hidden_to_emails
- Edit email headers: hide_inactive_sites_edit_site_hidden_headers
- Edit subject line: hide_inactive_sites_edit_site_hidden_subject
- Edit message (used above): hide_inactive_sites_edit_site_hidden_message
Site Warning Email
- Edit list of email recipients: hide_inactive_sites_edit_site_almost_hidden_to_emails
- Edit email headers: hide_inactive_sites_edit_site_almost_hidden_headers
- Edit subject line: hide_inactive_sites_edit_site_almost_hidden_subject
- Edit message: hide_inactive_sites_edit_site_almost_hidden_message
Plugin Options
- Edit update frequencies: hide-inactive-sites-manage-update-frequency
- Edit inactivity thresholds: hide-inactive-sites-manage-inactivity-thresholds
- Edit inactivity warning thresholds: hide-inactive-sites-manage-inactivity-warning-thresholds
- Edit number of minimum posts: hide-inactive-sites-manage-min-posts