function notices() { $message = ''; if (!isset($this->error) || !empty($_GET['loggedout'])) { $this->error = new WP_Error(); } if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) { //$this->error->add('test_cookie', __('Cookies are blocked or not supported by your browser. You must enable cookies to continue.', APP_TD)); } if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) { $message = __('You are now logged out.', APP_TD); } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) { $this->error->add('registerdisabled', __('User registration is currently not allowed.', APP_TD)); } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) { $message = __('Check your email for the confirmation link.', APP_TD); } elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) { $message = __('Check your email for your new password.', APP_TD); } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) { $message = __('Registration complete. Please check your e-mail.', APP_TD); } elseif (isset($_GET['action']) && 'lostpassword' == $_GET['action'] && !empty($_GET['success'])) { $message = __('Your password has been reset. Please login.', APP_TD); } if ($transient_notice = appthemes_get_visitor_transient('login_notice')) { appthemes_display_notice($transient_notice[0], $transient_notice[1]); appthemes_delete_visitor_transient('login_notice'); } if ($this->error->get_error_code()) { $error_html = ''; foreach ($this->error->errors as $error) { $error_html .= html('li', $error[0]); } appthemes_display_notice('error', html('ul class="errors"', $error_html)); } elseif (!empty($message)) { appthemes_display_notice('success', $message); } }
/** * Retrieves any previously stored transient notices * * @return array The list of stored transient notices */ private static function get_transient() { if (is_user_logged_in()) { $transient_notices = get_transient(self::$transient_key . '-' . get_current_user_id()); if ($transient_notices) { delete_transient(self::$transient_key . '-' . get_current_user_id()); } } else { $transient_notices = appthemes_get_visitor_transient(self::$transient_key); if ($transient_notices) { appthemes_delete_visitor_transient(self::$transient_key); } } return $transient_notices; }