Skip to content

Commit

Permalink
Small fix of cookie not saving
Browse files Browse the repository at this point in the history
  • Loading branch information
masonjmiller committed Jul 4, 2022
1 parent e2f8610 commit e96dc19
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions assets/js/easy-announcements.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ function check_easy_announcements_cookie(cookie) {

function set_easy_announcements_cookie(callback) {
var visitor_cookie = {};
for (const id of announcement_ids) {
visitor_cookie['dismiss-' + id] = 'false';
}
jQuery.each(announcement_ids, function (index, value) {
visitor_cookie['dismiss-' + value] = 'false';
});
visitor_cookie = JSON.stringify(visitor_cookie); // turn into string
visitor_cookie = btoa(visitor_cookie); // encrypt it
Cookies.set('easy_announcements', visitor_cookie, { expires: 7 });
Expand Down
2 changes: 1 addition & 1 deletion assets/js/easy-announcements.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions easy-announcements.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Easy Announcements
* Plugin URI: https://www.phillywebteam.com/project/easy-announcements/
* Description: Easily add announcements, banners, and popups to your WordPress site.
* Version: 0.1.4
* Version: 0.1.5
* Author: Philly Web Team
* Author URI: https://www.phillywebteam.com
* Text Domain: easy-announcements
Expand All @@ -14,7 +14,7 @@

define( 'EASY_ANNOUNCEMENTS_ABSPATH', WP_PLUGIN_DIR . '/easy-announcements' );
define( 'EASY_ANNOUNCEMENTS_PLUGIN_DIR', plugins_url( '/', __FILE__ ) );
define( 'EASY_ANNOUNCEMENTS_VERSION', '0.1.4' );
define( 'EASY_ANNOUNCEMENTS_VERSION', '0.1.5' );
define( 'EASY_ANNOUNCEMENTS_ACF_PATH', EASY_ANNOUNCEMENTS_ABSPATH . '/includes/acf/' );
define( 'EASY_ANNOUNCEMENTS_ACF_URL', EASY_ANNOUNCEMENTS_ABSPATH . '/includes/acf/' );

Expand Down
2 changes: 1 addition & 1 deletion includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function set_easy_announcements_cookie() {
setcookie( 'easy_announcements', base64_encode( json_encode( $cookie ) ), time() + 3600, '/' );
}
}
add_action( 'send_headers', 'set_easy_announcements_cookie' );
//add_action( 'send_headers', 'set_easy_announcements_cookie' );

function get_easy_announcements_cookie( $key ) {
if ( isset( $_COOKIE['easy_announcements'] ) ) {
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Tags: announcements, popups, banner, heading, announce, advertisement, advertise
Requires at least: 4.7
Tested up to: 6.0
Requires PHP: 5.6
Stable tag: 0.1.4
Stable tag: 0.1.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -33,6 +33,9 @@ Once you install and active please be sure to visit the settings page to configu

== Changelog ==

= 0.1.5 =
* Fixing cookie not saving

= 0.1.4 =
* Fixed headers error
* Beginning development of sticky headers
Expand Down

0 comments on commit e96dc19

Please sign in to comment.