From 76f4cfe4ced78533bdb5c4210464bf77bc1849da Mon Sep 17 00:00:00 2001 From: Paul Kirby Date: Wed, 24 Oct 2018 11:34:44 -0500 Subject: [PATCH] Only send email, as per plugin spec --- classes/LBRY_Admin.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/classes/LBRY_Admin.php b/classes/LBRY_Admin.php index ae1c040..9c14f3f 100644 --- a/classes/LBRY_Admin.php +++ b/classes/LBRY_Admin.php @@ -212,22 +212,20 @@ class LBRY_Admin // COMBAK: Check user permissions possibly public static function wallet_balance_warning() { - if (!get_transient('lbry_wallet_warning')) { + // See if we've checked in the past two hours + if (!get_transient('lbry_wallet_check')) { $balance = LBRY()->daemon->wallet_balance(); if ($balance < LBRY_MIN_BALANCE) { + // If LBRY Balance is low, send email, but only once per day if (!get_transient('lbry_wallet_warning_email')) { $email = get_option('admin_email'); $subject = 'Your LBRYPress Wallet Balance is Low!'; $message = "You LBRY Wallet for your wordpress installation at " . site_url() . " is running very low.\r\n\r\nYou currently have " . $balance . ' LBC left in your wallet. In order to keep publishing to the LBRY network, please add some LBC to your account.'; wp_mail($email, $subject, $message); set_transient('lbry_wallet_warning_email', true, DAY_IN_SECONDS); - // TODO: Fix outgoing email } - - LBRY()->notice->set_notice('error', 'Your account balance is low, please add LBC to your account to continue publishing to the LBRY Network', true); } - - set_transient('lbry_wallet_warning', true, 2 * HOUR_IN_SECONDS); + set_transient('lbry_wallet_check', true, 2 * HOUR_IN_SECONDS); } } }