From 109f18baf173cc7ae7181d726c3d7f3b9bb61f4b Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 4 Jan 2010 19:58:52 -0500 Subject: [PATCH] fix GH#41 --- functions.php | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/functions.php b/functions.php index 6a1afd9..1f496a6 100644 --- a/functions.php +++ b/functions.php @@ -68,6 +68,26 @@ function __comicpress_init() { remove_filter('comments_number','id_get_comment_number'); } + $storyline = get_option('comicpress-storyline-category-order'); + + $do_rebuild = false; + + if (empty($storyline)) { + $do_rebuild = true; + } else { + $first = array_pop(explode('/', array_shift(explode(',', $storyline)))); + + if ($first != $comicpress_options['comicpress_config']['comiccat']) { + $do_rebuild = true; + } + } + + if ($do_rebuild) { + $storyline = new ComicPressStoryline(); + + update_option('comicpress-storyline-category-order', $storyline->get_category_flattened($comicpress_options['comicpress_config']['comiccat'])); + } + do_action('comicpress_init'); if ($verified_nonce = __comicpress_verify_nonce()) { @@ -221,11 +241,6 @@ function comicpress_load_options() { update_option('comicpress_options', $comicpress_options); - $storyline = get_option('comicpress-storyline-category-order'); - if (empty($storyline)) { - update_option('comicpress-storyline-category-order', "0/$comiccat"); - } - return $comicpress_options; }