PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.1
Forumax – AI Powered Advanced Community Forum Plugin v2.5.1
2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 All 31 releases
← All changes | includes/sbv-compatibility.php +11 -3 2.5.0 → 2.5.1 View file →
@@ -52,11 +52,19 @@
52 52 forumax_remove_sbv_profile_action();
53 53 return;
54 54 }
55 55
56 - // Test if API actually works
57 - $user = sbv_api()->user($user_name);
58 - if (is_wp_error($user)) {
56 + // Test if API actually works. This is a remote request, so remember the
57 + // answer instead of calling the API on every profile page view.
58 + $cache_key = 'frmx_sbv_api_ok_' . md5($user_name . '|' . $api_token);
59 + $api_ok = get_transient($cache_key);
60 +
61 + if (false === $api_ok) {
62 + $api_ok = is_wp_error(sbv_api()->user($user_name)) ? 'no' : 'yes';
63 + set_transient($cache_key, $api_ok, 'yes' === $api_ok ? 12 * HOUR_IN_SECONDS : 15 * MINUTE_IN_SECONDS);
64 + }
65 +
66 + if ('yes' !== $api_ok) {
59 67 forumax_remove_sbv_profile_action();
60 68 }
61 69 }
62 70