PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.0
Forumax – AI Powered Advanced Community Forum Plugin v2.5.0
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 2.0.0 All 30 releases
← All changes | includes/functions.php +43 -19 2.4.0 → 2.5.0 View file →
@@ -18,8 +18,30 @@
18 18 return $default;
19 19 }
20 20
21 21 /**
22 + * Render the guest login form used on topic/reply/forum prompts.
23 + *
24 + * Uses the Shortcodes setting when set; otherwise falls back to [forumax_login_form]
25 + * so Sign In / Create Account tabs always appear (when registration is allowed).
26 + *
27 + * @return void
28 + */
29 +function forumax_render_topic_login_form() {
30 + $shortcode = '';
31 +
32 + if ( function_exists( 'forumax_get_opt' ) ) {
33 + $shortcode = trim( (string) forumax_get_opt( 'topic_login_shortcode', '[forumax_login_form]' ) );
34 + }
35 +
36 + if ( '' === $shortcode ) {
37 + $shortcode = '[forumax_login_form]';
38 + }
39 +
40 + echo do_shortcode( $shortcode ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
41 +}
42 +
43 +/**
22 44 * Check if a plugin has been installed for specific number of days
23 45 *
24 46 * @param string $plugin_path The plugin path (e.g. 'woocommerce/woocommerce.php')
25 47 * @param int $days Number of days to check against
@@ -611,9 +633,9 @@
611 633 }
612 634 add_filter( 'user_has_cap', 'forumax_grant_bbpress_caps_to_admins', 10, 3 );
613 635
614 636 /**
615 - * Mutual Deactivation of Forumax and bbp-core plugins
637 + * Mutual Deactivation of old and new plugin paths
616 638 */
617 639 add_action( 'activated_plugin', function( $plugin ) {
618 640 if ( ! function_exists( 'is_plugin_active' ) ) {
619 641 require_once ABSPATH . 'wp-admin/includes/plugin.php';
@@ -618,31 +640,33 @@
618 640 if ( ! function_exists( 'is_plugin_active' ) ) {
619 641 require_once ABSPATH . 'wp-admin/includes/plugin.php';
620 642 }
621 643
622 - // All Forumax plugins
623 - $forumax_plugins = [
624 - 'forumax/forumax.php',
625 - 'forumax-pro/forumax.php',
626 - ];
644 + $free_plugins_new = [ 'forumax/forumax.php' ];
645 + $free_plugins_old = [ 'bbp-core/bbp-core.php', 'bbp-core/forumax.php' ];
646 +
647 + $pro_plugins_new = [ 'forumax-pro/forumax.php' ];
648 + $pro_plugins_old = [ 'bbp-core-pro/bbp-core.php', 'forumax-premium/bbp-core.php', 'forumax-premium/forumax.php' ];
627 649
628 - // All bbp-core plugins
629 - $bbp_core_plugins = [
630 - 'bbp-core/bbp-core.php',
631 - 'bbp-core-pro/bbp-core.php',
632 - ];
650 + // If activating NEW free, deactivate OLD free
651 + if ( in_array( $plugin, $free_plugins_new, true ) ) {
652 + deactivate_plugins( $free_plugins_old );
653 + }
633 654
634 - // If activating Forumax (free or pro) → deactivate bbp-core (all versions)
635 - if ( in_array( $plugin, $forumax_plugins, true ) ) {
636 - deactivate_plugins( $bbp_core_plugins );
655 + // If activating OLD free, deactivate NEW free
656 + if ( in_array( $plugin, $free_plugins_old, true ) ) {
657 + deactivate_plugins( $free_plugins_new );
637 658 }
659 +
660 + // If activating NEW pro, deactivate OLD pro
661 + if ( in_array( $plugin, $pro_plugins_new, true ) ) {
662 + deactivate_plugins( $pro_plugins_old );
663 + }
638 664
639 -
640 - // If activating bbp-core (free or pro) → deactivate Forumax (all versions)
641 - if ( in_array( $plugin, $bbp_core_plugins, true ) ) {
642 - deactivate_plugins( $forumax_plugins );
665 + // If activating OLD pro, deactivate NEW pro
666 + if ( in_array( $plugin, $pro_plugins_old, true ) ) {
667 + deactivate_plugins( $pro_plugins_new );
643 668 }
644 -
645 669 } );
646 670
647 671 /**
648 672 * Register Forum Sidebar widget area