$notice) { $this->create_admin_notice($notice); } delete_transient('lbry_notices'); } } /** * Sets transients for admin errors */ // TODO: Make sure we only set one transient at a time per error public function set_notice($status = 'error', $message = 'Something went wrong', $is_dismissible = false) { $notice = array( 'status' => $status, 'message' => $message, 'is_dismissible' => $is_dismissible ); if (! get_transient('lbry_notices')) { set_transient('lbry_notices', array($notice)); } else { $notices = get_transient('lbry_notices'); if (!in_array($notice, $notices)) { $notices[] = $notice; } set_transient('lbry_notices', $notices); } } /** * Prints an admin notice */ private function create_admin_notice($notice) { $class = 'notice notice-' . $notice['status']; if ($notice['is_dismissible']) { $class .= ' is-dismissible'; } ob_start(); ?>
LBRYPress: = $notice['message'] ?>