function process_socialize_settings_admin() { if (!empty($_POST['socialize_default_reset'])) { if (strstr($_GET['page'], "socialize") && check_admin_referer('socialize-update-settings_options')) { $socialize_settings = socializeWP::get_options(); // If Buttons or Both if ($_POST['socialize_default_type'] == 'buttons/cta' || $_POST['socialize_default_type'] == 'buttons') { $socializemetaarray = array(); if (isset($_POST['socialize_buttons'])) { foreach ($_POST['socialize_buttons'] as $button) { if ($button > 0) { array_push($socializemetaarray, $button); } } } $socializemeta = implode(',', $socializemetaarray); $socialize_settings['sharemeta'] = $socializemeta; } // If CTA or Both if ($_POST['socialize_default_type'] == 'buttons/cta' || $_POST['socialize_default_type'] == 'cta') { $socialize_text = $_POST['socialize_text']; $socialize_settings['socialize_text'] = stripslashes($_POST['socialize_text']); } // Loop through all posts with socialize custom meta and update with new settings $mod_posts = new WP_Query(array('meta_key' => 'socialize', 'post_status' => array('publish', 'pending', 'draft', 'future', 'private'), 'post_type' => 'any', 'posts_per_page' => -1)); while ($mod_posts->have_posts()) { $mod_posts->the_post(); if ($_POST['socialize_default_type'] == 'buttons/cta' || $_POST['socialize_default_type'] == 'buttons') { update_post_meta(get_the_ID(), 'socialize', $socializemeta); } if ($_POST['socialize_default_type'] == 'buttons/cta' || $_POST['socialize_default_type'] == 'cta') { update_post_meta(get_the_ID(), 'socialize_text', $socialize_text); } } wp_reset_postdata(); // Update settings socializeWP::update_options($socialize_settings); // Update user echo "<div id=\"updatemessage\" class=\"updated fade\"><p>Default Socialize settings updated.</p></div>\n"; echo "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>"; } } if (!empty($_POST['socialize_option_submitted'])) { if (strstr($_GET['page'], "socialize") && check_admin_referer('socialize-update-settings_options')) { $socialize_settings = socializeWP::get_options(); $socializemetaarray = array(); if (isset($_POST['socialize_buttons'])) { foreach ($_POST['socialize_buttons'] as $button) { if ($button > 0) { array_push($socializemetaarray, $button); } } } $socializemeta = implode(',', $socializemetaarray); $socialize_settings['sharemeta'] = $socializemeta; $socialize_text = $_POST['socialize_text']; $socialize_settings['socialize_text'] = stripslashes($_POST['socialize_text']); if (isset($_POST['socialize_bitly_name'])) { $socialize_settings['socialize_bitly_name'] = $_POST['socialize_bitly_name']; } if (isset($_POST['socialize_bitly_key'])) { $socialize_settings['socialize_bitly_key'] = $_POST['socialize_bitly_key']; } if (isset($_POST['socialize_fb_appid'])) { $socialize_settings['socialize_fb_appid'] = $_POST['socialize_fb_appid']; } if (isset($_POST['socialize_fb_adminid'])) { $socialize_settings['socialize_fb_adminid'] = $_POST['socialize_fb_adminid']; } if (isset($_POST['socialize_og'])) { $socialize_settings['socialize_og'] = $_POST['socialize_og']; } else { $socialize_settings['socialize_og'] = ''; } if (isset($_POST['socialize_fb_pageid'])) { $socialize_settings['socialize_fb_pageid'] = $_POST['socialize_fb_pageid']; } else { $socialize_settings['socialize_fb_pageid'] = ''; } echo "<div id=\"updatemessage\" class=\"updated fade\"><p>Socialize settings updated.</p></div>\n"; echo "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>"; socializeWP::update_options($socialize_settings); } } //updated $socialize_settings = socializeWP::get_options(); return $socialize_settings; }