if ($old_roles !== $new_roles) { $pc_wp_user->wps_roles = $new_roles; $pc_wp_user->set_wps_custom_roles(); update_option($key, $new_roles); } } else { if ($fdata[$key] === false) { delete_option($key); } else { update_option($key, $fdata[$key]); } } } // create custom style css file if (!get_option('pg_inline_css') && $fdata['pg_style'] == 'custom') { if (!pc_create_custom_style()) { update_option('pg_inline_css', 1); echo '<div class="updated"><p>' . __('An error occurred during dynamic CSS creation. The code will be used inline anyway', 'pc_ml') . '</p></div>'; } else { delete_option('pg_inline_css'); } } echo '<div class="updated"><p><strong>' . __('Options saved', 'pc_ml') . '</strong></p></div>'; } } else { // Normal page display $fdata['pg_target_page'] = get_option('pg_target_page'); $fdata['pg_target_page_content'] = get_option('pg_target_page_content'); $fdata['pg_pvtpage_default_content'] = get_option('pg_pvtpage_default_content'); $fdata['pg_pvtpage_enable_preset'] = get_option('pg_pvtpage_enable_preset'); $fdata['pg_pvtpage_preset_pos'] = get_option('pg_pvtpage_preset_pos');
function pc_on_activation() { include_once PC_DIR . '/functions.php'; // check mcrypt_encrypt functions existence if (!function_exists('mcrypt_encrypt')) { deactivate_plugins(plugin_basename(__FILE__)); wp_die("PrivateContent cannot be enabled because of your PHP version doesn't support Mcrypt functions.<br/>\r\n\t\tPlease enable it or ask to your hoster. Thanks"); } // create custom form style if (get_option('pg_style') == 'custom') { if (!pc_create_custom_style()) { update_option('pg_inline_css', 1); } else { delete_option('pg_inline_css'); } } // minimum role to use plugin if (!get_option('pg_min_role')) { update_option('pg_min_role', 'upload_files'); } }