From 133f419e8424157f6c66254ab35e070f530fe93a Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 12 Jul 2009 18:50:55 -0400 Subject: [PATCH] force auto attach works --- addons/Core/Core.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/addons/Core/Core.inc b/addons/Core/Core.inc index 07cf40e..0f6e6ea 100644 --- a/addons/Core/Core.inc +++ b/addons/Core/Core.inc @@ -56,6 +56,14 @@ class ComicPressAddonCore extends ComicPressAddon { 'html' => '
' . implode("\n", $field_html_lines) . '
' ); + $form_fields['auto_attach'] = array( + 'label' => __("Auto-attach?", 'comicpress'), + 'input' => 'html', + 'html' => ' ' + . __('Attach to this post w/o needing to insert into post', 'comicpress') + . '' + ); + return $form_fields; } @@ -128,6 +136,13 @@ class ComicPressAddonCore extends ComicPressAddon { if (isset($settings['comic_image_type'])) { update_post_meta($post_id, 'comic_image_type', $settings['comic_image_type']); } + if (isset($settings['auto_attach'])) { + if (isset($settings['post_parent'])) { + $media_post = get_post($post_id); + $media_post->post_parent = $settings['post_parent']; + wp_update_post($media_post); + } + } } } else { //coming from us