PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / trunk
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript vtrunk
4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 1.9.3 1.9.4 1.9.5 1.9.6 All 170 releases
← All changes | inc/class-berqwp.php +20 -2 4.1.13trunk View file →
@@ -963,11 +963,29 @@
963 963
964 964 function save_settings()
965 965 {
966 966
967 - if (!empty($_GET['page']) && $_GET['page'] == 'berqwp' && isset($_GET['activate-free'])) {
967 + if (current_user_can('manage_options') && !empty($_GET['page']) && $_GET['page'] == 'berqwp' && isset($_GET['activate-free'])) {
968 968 $berqconfigs = berqConfigs::getInstance();
969 - $berqconfigs->update_configs(['optimization_method' => 'local']);
969 + $configs = $berqconfigs->get_configs();
970 + $site_id = $configs['site_id'];
971 +
972 + if (empty($site_id)) {
973 + $site_id = berqwp_generate_site_id();
974 + }
975 +
976 + $berqconfigs->update_configs([
977 + 'site_id' => $site_id,
978 + 'optimization_method' => 'local'
979 + ]);
980 +
981 + wp_remote_post(BerqWPCloud::$endpoint."free-user", [
982 + 'timeout' => 30,
983 + 'body' => [
984 + 'site_id' => $site_id,
985 + 'site_url' => get_option('home'),
986 + ]
987 + ]);
970 988
971 989 $location = get_admin_url() . 'admin.php?page=berqwp';
972 990 wp_safe_redirect($location);
973 991 exit;