From 2b69e6b06d9c734b71ffb9b3055a291627730f99 Mon Sep 17 00:00:00 2001 From: Kartik Suthar Date: Fri, 20 Sep 2024 12:37:47 +0530 Subject: [PATCH 001/233] ARCH-145 - implement backend menu and navigations for the ready launch --- src/bp-core/admin/bp-core-admin-functions.php | 6 ++- .../admin/templates/readylaunch-screen.php | 0 src/bp-core/classes/class-bp-admin.php | 37 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/bp-core/admin/templates/readylaunch-screen.php diff --git a/src/bp-core/admin/bp-core-admin-functions.php b/src/bp-core/admin/bp-core-admin-functions.php index f7b66c3276..122eba6894 100644 --- a/src/bp-core/admin/bp-core-admin-functions.php +++ b/src/bp-core/admin/bp-core-admin-functions.php @@ -698,7 +698,11 @@ function bp_core_get_admin_tabs( $active_tab = '' ) { 'name' => __( 'Credits', 'buddyboss' ), 'class' => 'bp-credits', ), - + '8' => array( + 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bb-readylaunch' ), 'admin.php' ) ), + 'name' => __( 'ReadyLaunch™', 'buddyboss' ), + 'class' => 'bb-readylaunch', + ), ); /** diff --git a/src/bp-core/admin/templates/readylaunch-screen.php b/src/bp-core/admin/templates/readylaunch-screen.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/bp-core/classes/class-bp-admin.php b/src/bp-core/classes/class-bp-admin.php index b017291b61..dd6dccadaa 100644 --- a/src/bp-core/classes/class-bp-admin.php +++ b/src/bp-core/classes/class-bp-admin.php @@ -370,6 +370,16 @@ public function admin_menus_components() { 'bp-credits', array( $this, 'bp_credits_screen' ) ); + + // Credits. + $hooks[] = add_submenu_page( + $this->settings_page, + __( 'ReadyLaunch™', 'buddyboss' ), + __( 'ReadyLaunch™', 'buddyboss' ), + $this->capability, + 'bb-readylaunch', + array( $this, 'bb_readylaunch_screen' ) + ); } /** @@ -532,6 +542,16 @@ public function admin_menus() { array( $this, 'bp_credits_screen' ) ); + // Credits. + $hooks[] = add_submenu_page( + $this->settings_page, + __( 'ReadyLaunch™', 'buddyboss' ), + __( 'ReadyLaunch™', 'buddyboss' ), + $this->capability, + 'bb-readylaunch', + array( $this, 'bb_readylaunch_screen' ) + ); + // For consistency with non-Multisite, we add a Tools menu in // the Network Admin as a home for our Tools panel. if ( is_multisite() && bp_core_do_network_admin() ) { @@ -669,6 +689,23 @@ public function bp_upgrade_screen() { + +
+ + admin_dir . 'templates/readylaunch-screen.php'; ?> +
+ + Date: Mon, 23 Sep 2024 16:47:47 +0530 Subject: [PATCH 002/233] ARCH-145 - created backend settings to enable the component pages --- src/bp-core/bp-core-actions.php | 14 ++ src/bp-core/bp-core-functions.php | 4 + src/bp-core/classes/class-bb-readylaunch.php | 154 +++++++++++++++++++ src/bp-core/classes/class-bp-admin.php | 26 +++- src/class-buddypress.php | 1 + 5 files changed, 197 insertions(+), 2 deletions(-) create mode 100644 src/bp-core/classes/class-bb-readylaunch.php diff --git a/src/bp-core/bp-core-actions.php b/src/bp-core/bp-core-actions.php index 34c8418e44..50614247f2 100644 --- a/src/bp-core/bp-core-actions.php +++ b/src/bp-core/bp-core-actions.php @@ -1205,3 +1205,17 @@ function bb_load_web_performance_tester() { bb_web_performance_tester(); } } + + +/** + * Function to load readylaunch class. + * + * @since BuddyBoss [BBVERSION] + */ +function bb_load_readylaunch() { + if ( class_exists( 'BB_Readylaunch' ) ) { + BB_Readylaunch::instance(); + } +} + +add_action( 'bp_init', 'bb_load_readylaunch' ); diff --git a/src/bp-core/bp-core-functions.php b/src/bp-core/bp-core-functions.php index c784f36f0f..f0df238091 100644 --- a/src/bp-core/bp-core-functions.php +++ b/src/bp-core/bp-core-functions.php @@ -9898,3 +9898,7 @@ function bb_remove_deleted_user_last_activities() { function bb_pro_poll_version() { return '2.6.00'; } + +function bb_get_enabled_readylaunch() { + return bp_get_option( 'bb_readylaunch', array() ); +} diff --git a/src/bp-core/classes/class-bb-readylaunch.php b/src/bp-core/classes/class-bb-readylaunch.php new file mode 100644 index 0000000000..879a621193 --- /dev/null +++ b/src/bp-core/classes/class-bb-readylaunch.php @@ -0,0 +1,154 @@ + $label ) { + if ( + ! empty( $bp_pages[ $name ] ) || + ( + $name === 'new_forums_page' && + ! empty( bp_get_forum_page_id() ) + ) + ) { + add_settings_field( $name, $label, array( $this, 'bb_enable_setting_callback_page_directory' ), 'bb-readylaunch', 'bb_readylaunch', compact( 'enabled_pages', 'name', 'label', 'description' ) ); + register_setting( 'bb-readylaunch', $name, array() ); + } + } + + } + + public function bb_admin_readylaunch_pages_description() { + + } + + /** + * Pages drop downs callback + * + * @since BuddyBoss [BBVERSION] + * + * @param $args + */ + public function bb_enable_setting_callback_page_directory( $args ) { + extract( $args ); + + if ( ! bp_is_root_blog() ) { + switch_to_blog( bp_get_root_blog_id() ); + } + + $checked = ! empty( $enabled_pages ) && isset( $enabled_pages[ $name ] ); + + // For the button. + if ( 'button' === $name ) { + + printf( '

%s

', $args['label']['link'], $args['label']['label'] ); + // For the forums will set the page selected from the custom option `_bbp_root_slug_custom_slug`. + } else { + echo ''; + } + + if ( ! bp_is_root_blog() ) { + restore_current_blog(); + } + } + + public function bb_core_admin_maybe_save_readylaunch_settings() { + if ( ! isset( $_GET['page'] ) || ! isset( $_POST['submit'] ) ) { + return false; + } + + if ( 'bb-readylaunch' !== $_GET['page'] ) { + return false; + } + + if ( ! check_admin_referer( 'bb-readylaunch-options' ) ) { + return false; + } + + if ( isset( $_POST['bb-readylaunch'] ) ) { + bp_update_option( 'bb_readylaunch', $_POST['bb-readylaunch'] ); + } + + bp_core_redirect( + bp_get_admin_url( + add_query_arg( + array( + 'page' => 'bb-readylaunch', + 'added' => 'true', + ), + 'admin.php' + ) + ) + ); + } + } +} diff --git a/src/bp-core/classes/class-bp-admin.php b/src/bp-core/classes/class-bp-admin.php index dd6dccadaa..587f54db07 100644 --- a/src/bp-core/classes/class-bp-admin.php +++ b/src/bp-core/classes/class-bp-admin.php @@ -696,10 +696,32 @@ public function bp_upgrade_screen() { */ public function bb_readylaunch_screen() { ?> -
- admin_dir . 'templates/readylaunch-screen.php'; ?> +
+

', esc_attr__( 'Save Settings', 'buddyboss' ) ); + } else { + // Show a disabled "Save Settings" button if the current language is not the default language. + printf( '

%s

', esc_attr__( 'Save Settings', 'buddyboss' ) ); + printf( '

%s

', esc_attr__( 'You need to switch to your Default language in WPML to save these settings.', 'buddyboss' ) ); + } + } else { + printf( '

', esc_attr__( 'Save Settings', 'buddyboss' ) ); + } + ?> +
'core', 'BB_Reaction' => 'core', 'BB_BG_Process_Log' => 'core', + 'BB_Readylaunch' => 'core', // BuddyBoss Platform Rest API classes. 'BP_REST_Components_Endpoint' => 'core', From bbae6ac267ff1f26db6899f2d4f023f79848e0e5 Mon Sep 17 00:00:00 2001 From: Kartik Suthar Date: Tue, 24 Sep 2024 11:47:51 +0530 Subject: [PATCH 003/233] ARCH-145 - load the custom template for the readylaunch --- src/bp-core/classes/class-bb-readylaunch.php | 42 +++++++++++++++---- .../bp-nouveau/readylaunch/layout.php | 41 ++++++++++++++++++ 2 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 src/bp-templates/bp-nouveau/readylaunch/layout.php diff --git a/src/bp-core/classes/class-bb-readylaunch.php b/src/bp-core/classes/class-bb-readylaunch.php index 879a621193..55a31c16eb 100644 --- a/src/bp-core/classes/class-bb-readylaunch.php +++ b/src/bp-core/classes/class-bb-readylaunch.php @@ -53,6 +53,7 @@ public static function instance() { public function __construct() { add_action( 'bp_admin_init', array( $this, 'bb_core_admin_readylaunch_page_fields' ) ); add_action( 'bp_admin_init', array( $this, 'bb_core_admin_maybe_save_readylaunch_settings' ), 100 ); + add_filter( 'template_include', array( $this, 'override_page_templates' ), 999999 ); // High priority so we have the last say here } public function bb_core_admin_readylaunch_page_fields() { @@ -68,9 +69,9 @@ public function bb_core_admin_readylaunch_page_fields() { $wp_settings_sections['bb-readylaunch']['bb_readylaunch']['icon'] = bb_admin_icons( 'bb_readylaunch' ); } - $enabled_pages = bb_get_enabled_readylaunch(); - $bp_pages = bp_core_get_directory_page_ids( 'all' ); - $description = ''; + $enabled_pages = bb_get_enabled_readylaunch(); + $bp_pages = bp_core_get_directory_page_ids( 'all' ); + $description = ''; foreach ( $directory_pages as $name => $label ) { if ( @@ -84,11 +85,9 @@ public function bb_core_admin_readylaunch_page_fields() { register_setting( 'bb-readylaunch', $name, array() ); } } - } public function bb_admin_readylaunch_pages_description() { - } /** @@ -105,15 +104,21 @@ public function bb_enable_setting_callback_page_directory( $args ) { switch_to_blog( bp_get_root_blog_id() ); } - $checked = ! empty( $enabled_pages ) && isset( $enabled_pages[ $name ] ); + $bp_pages = bp_core_get_directory_page_ids( 'all' ); + $checked = ! empty( $enabled_pages ) && isset( $enabled_pages[ $name ] ); + + if ( 'new_forums_page' === $name ) { + $val = bp_get_forum_page_id(); + } else { + $val = ! empty( $bp_pages ) && isset( $bp_pages[ $name ] ) ? $bp_pages[ $name ] : ''; + } // For the button. if ( 'button' === $name ) { - printf( '

%s

', $args['label']['link'], $args['label']['label'] ); // For the forums will set the page selected from the custom option `_bbp_root_slug_custom_slug`. } else { - echo ''; + echo ''; } if ( ! bp_is_root_blog() ) { @@ -150,5 +155,26 @@ public function bb_core_admin_maybe_save_readylaunch_settings() { ) ); } + + public function override_page_templates( $template ) { + global $post; + $enabled_pages = bb_get_enabled_readylaunch(); + $enabled_pages = wp_parse_id_list( $enabled_pages ); + + if ( + ! empty( $post->ID ) && + in_array( $post->ID, $enabled_pages, true ) + ) { + $compponent = array_search( $post->ID, $enabled_pages, true ); + if ( ! empty( $compponent ) && bp_is_active( $compponent ) ) { + $template = bp_locate_template( 'readylaunch/layout.php' ); + if ( $template ) { + return $template; + } + } + } + + return $template; + } } } diff --git a/src/bp-templates/bp-nouveau/readylaunch/layout.php b/src/bp-templates/bp-nouveau/readylaunch/layout.php new file mode 100644 index 0000000000..d61379fba8 --- /dev/null +++ b/src/bp-templates/bp-nouveau/readylaunch/layout.php @@ -0,0 +1,41 @@ + + +> + + + + + + + + + +> + +
+ + +
+ +
+ + Footer + + + + From 90dada413719c031c8889f30ad6f8cebd38276ab Mon Sep 17 00:00:00 2001 From: Kartik Suthar Date: Thu, 19 Dec 2024 18:31:50 +0530 Subject: [PATCH 004/233] ARCH-145 - implement member directory using API --- src/bp-core/classes/class-bb-readylaunch.php | 11 +- .../bp-nouveau/readylaunch/layout.php | 107 +++++++++++++++--- 2 files changed, 103 insertions(+), 15 deletions(-) diff --git a/src/bp-core/classes/class-bb-readylaunch.php b/src/bp-core/classes/class-bb-readylaunch.php index 55a31c16eb..b7307ab8a6 100644 --- a/src/bp-core/classes/class-bb-readylaunch.php +++ b/src/bp-core/classes/class-bb-readylaunch.php @@ -82,7 +82,9 @@ public function bb_core_admin_readylaunch_page_fields() { ) ) { add_settings_field( $name, $label, array( $this, 'bb_enable_setting_callback_page_directory' ), 'bb-readylaunch', 'bb_readylaunch', compact( 'enabled_pages', 'name', 'label', 'description' ) ); - register_setting( 'bb-readylaunch', $name, array() ); + register_setting( 'bb-readylaunch', $name, array( + 'default' => array() + ) ); } } } @@ -169,6 +171,7 @@ public function override_page_templates( $template ) { if ( ! empty( $compponent ) && bp_is_active( $compponent ) ) { $template = bp_locate_template( 'readylaunch/layout.php' ); if ( $template ) { + add_action( 'wp_enqueue_scripts', array( $this, 'bb_readylaunch_enqueue' ) ); return $template; } } @@ -176,5 +179,11 @@ public function override_page_templates( $template ) { return $template; } + + + public function bb_readylaunch_enqueue() { + wp_enqueue_script( 'bp-api-request'); + } } + } diff --git a/src/bp-templates/bp-nouveau/readylaunch/layout.php b/src/bp-templates/bp-nouveau/readylaunch/layout.php index d61379fba8..725abafc70 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/layout.php +++ b/src/bp-templates/bp-nouveau/readylaunch/layout.php @@ -7,35 +7,114 @@ > - - - + + + - + + + > - -
- -
+
-
- - Footer - +
+
+
    +
  • Loading...
  • +
+
+
+
+ From 0e6a1cf8f0d367cf753e28064a2605d6d66d2965 Mon Sep 17 00:00:00 2001 From: Kartik Suthar Date: Fri, 20 Dec 2024 17:40:19 +0530 Subject: [PATCH 005/233] ARCH-145 - implement API cache support --- src/bp-core/classes/class-bb-readylaunch.php | 3 + src/bp-core/js/readylaunch.js | 60 +++++++++++++++++++ .../bp-nouveau/readylaunch/layout.php | 39 ------------ 3 files changed, 63 insertions(+), 39 deletions(-) create mode 100644 src/bp-core/js/readylaunch.js diff --git a/src/bp-core/classes/class-bb-readylaunch.php b/src/bp-core/classes/class-bb-readylaunch.php index b7307ab8a6..4c31fac1c6 100644 --- a/src/bp-core/classes/class-bb-readylaunch.php +++ b/src/bp-core/classes/class-bb-readylaunch.php @@ -182,7 +182,10 @@ public function override_page_templates( $template ) { public function bb_readylaunch_enqueue() { + global $bp; wp_enqueue_script( 'bp-api-request'); + // Enqueue CSS and JavaScript. + wp_enqueue_script( 'bb-readylaunch', $bp->plugin_url . "bp-core/js/readylaunch.js", array( 'jquery', 'wp-backbone', 'bp-api-request' ), bp_get_version() ); } } diff --git a/src/bp-core/js/readylaunch.js b/src/bp-core/js/readylaunch.js new file mode 100644 index 0000000000..ae7d89c269 --- /dev/null +++ b/src/bp-core/js/readylaunch.js @@ -0,0 +1,60 @@ +/* globals BP_HELP, WPAPI */ +/** + * BuddyBoss Help implementation. + * + * @since BuddyBoss 1.2.1 + */ +window.wp = window.wp || {}; +window.bp = window.bp || {}; + +(function ( exports, $ ) { + + _.extend( bp, _.pick( wp, 'Backbone', 'ajax', 'template' ) ); + + var options = options || {}; + options.context = 'view'; + options.data = options.data || {}; + options.path = 'buddyboss/v1/members'; + options.method = 'GET'; + + options.data = _.extend( + options.data, + { + page: 1, + per_page: 20, + } + ); + + bp.apiRequest( options ).done( + function ( data ) { + // Get the container and template. + var container = $( '#members-list' ); + var template = _.template( $( '#member-template' ).html() ); + + container.empty(); // Clear previous data if any. + + // Loop through the data and apply the template. + data.forEach( + function (member) { + var memberHTML = template( + { + avatar: member.avatar_urls.full, + name: member.name, + id: member.id, + url: member.link, + followers: member.followers, + type: 'Member', + } + ); + + container.append( memberHTML ); + } + ); + } + ).fail( + function () { + console.log( 'error' ); + } + ); + +} )( bp, jQuery ); diff --git a/src/bp-templates/bp-nouveau/readylaunch/layout.php b/src/bp-templates/bp-nouveau/readylaunch/layout.php index 725abafc70..cd81564713 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/layout.php +++ b/src/bp-templates/bp-nouveau/readylaunch/layout.php @@ -47,45 +47,6 @@
- > From a516fae3ffef4b65b7d9fc81fc433f0d274e1597 Mon Sep 17 00:00:00 2001 From: Kartik Suthar Date: Mon, 23 Dec 2024 13:20:08 +0530 Subject: [PATCH 006/233] ARCH-145 - Load the templates from the readylaunch and restrict overwriting into theme --- src/bp-core/classes/class-bb-readylaunch.php | 26 ++++++++++++++++++- .../bp-nouveau/readylaunch/layout.php | 7 ++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/bp-core/classes/class-bb-readylaunch.php b/src/bp-core/classes/class-bb-readylaunch.php index 4c31fac1c6..326545f5ee 100644 --- a/src/bp-core/classes/class-bb-readylaunch.php +++ b/src/bp-core/classes/class-bb-readylaunch.php @@ -54,6 +54,9 @@ public function __construct() { add_action( 'bp_admin_init', array( $this, 'bb_core_admin_readylaunch_page_fields' ) ); add_action( 'bp_admin_init', array( $this, 'bb_core_admin_maybe_save_readylaunch_settings' ), 100 ); add_filter( 'template_include', array( $this, 'override_page_templates' ), 999999 ); // High priority so we have the last say here + // Filter BuddyPress template locations. + remove_filter( 'bp_get_template_stack', 'bp_add_template_stack_locations' ); + add_filter( 'bp_get_template_stack', array( $this, 'add_template_stack' ), PHP_INT_MAX ); } public function bb_core_admin_readylaunch_page_fields() { @@ -169,7 +172,7 @@ public function override_page_templates( $template ) { ) { $compponent = array_search( $post->ID, $enabled_pages, true ); if ( ! empty( $compponent ) && bp_is_active( $compponent ) ) { - $template = bp_locate_template( 'readylaunch/layout.php' ); + $template = bp_locate_template( 'layout.php' ); if ( $template ) { add_action( 'wp_enqueue_scripts', array( $this, 'bb_readylaunch_enqueue' ) ); return $template; @@ -187,6 +190,27 @@ public function bb_readylaunch_enqueue() { // Enqueue CSS and JavaScript. wp_enqueue_script( 'bb-readylaunch', $bp->plugin_url . "bp-core/js/readylaunch.js", array( 'jquery', 'wp-backbone', 'bp-api-request' ), bp_get_version() ); } + + public function add_template_stack( $stack ) { + + $stylesheet_dir = get_stylesheet_directory(); + $template_dir = get_template_directory(); + + $stack = array_flip($stack); + + unset( $stack[$stylesheet_dir], $stack[$template_dir] ); + + $stack = array_flip($stack); + + $custom_location = 'readylaunch'; + + foreach ( $stack as $key => $value ) { + $stack[$key] = untrailingslashit( trailingslashit( $value ) . $custom_location ); + } + + return $stack; + + } } } diff --git a/src/bp-templates/bp-nouveau/readylaunch/layout.php b/src/bp-templates/bp-nouveau/readylaunch/layout.php index cd81564713..8e10135bce 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/layout.php +++ b/src/bp-templates/bp-nouveau/readylaunch/layout.php @@ -63,9 +63,10 @@ while ( have_posts() ) : the_post(); -// the_content(); + the_content(); endwhile; endif; + /* ?>
@@ -74,7 +75,11 @@
+ +
+ FOOTER +
From 16d516422bc7dc66d4d42940c6f900deffec8540 Mon Sep 17 00:00:00 2001 From: Kartik Suthar Date: Thu, 26 Dec 2024 14:39:59 +0530 Subject: [PATCH 007/233] ARCH-145 - load components and templates conditionally --- src/bp-core/classes/class-bb-readylaunch.php | 90 ++++++++++++-------- 1 file changed, 53 insertions(+), 37 deletions(-) diff --git a/src/bp-core/classes/class-bb-readylaunch.php b/src/bp-core/classes/class-bb-readylaunch.php index 326545f5ee..d3ffde761d 100644 --- a/src/bp-core/classes/class-bb-readylaunch.php +++ b/src/bp-core/classes/class-bb-readylaunch.php @@ -51,15 +51,25 @@ public static function instance() { * @since BuddyBoss [BBVERSION] */ public function __construct() { + + $enabled = $this->is_readylaunch_enabled(); + add_action( 'bp_admin_init', array( $this, 'bb_core_admin_readylaunch_page_fields' ) ); add_action( 'bp_admin_init', array( $this, 'bb_core_admin_maybe_save_readylaunch_settings' ), 100 ); - add_filter( 'template_include', array( $this, 'override_page_templates' ), 999999 ); // High priority so we have the last say here - // Filter BuddyPress template locations. - remove_filter( 'bp_get_template_stack', 'bp_add_template_stack_locations' ); - add_filter( 'bp_get_template_stack', array( $this, 'add_template_stack' ), PHP_INT_MAX ); + + if ( $enabled ) { + add_filter( 'template_include', array( $this, 'override_page_templates' ), 999999 ); // High priority so we have the last say here + + // Filter BuddyPress template locations. + remove_filter( 'bp_get_template_stack', 'bp_add_template_stack_locations' ); + + add_filter( 'bp_get_template_stack', array( $this, 'add_template_stack' ), PHP_INT_MAX ); + } } public function bb_core_admin_readylaunch_page_fields() { + global $wp_settings_sections; + add_settings_section( 'bb_readylaunch', __( 'ReadyLaunch', 'buddyboss' ), @@ -109,21 +119,14 @@ public function bb_enable_setting_callback_page_directory( $args ) { switch_to_blog( bp_get_root_blog_id() ); } - $bp_pages = bp_core_get_directory_page_ids( 'all' ); $checked = ! empty( $enabled_pages ) && isset( $enabled_pages[ $name ] ); - if ( 'new_forums_page' === $name ) { - $val = bp_get_forum_page_id(); - } else { - $val = ! empty( $bp_pages ) && isset( $bp_pages[ $name ] ) ? $bp_pages[ $name ] : ''; - } - // For the button. if ( 'button' === $name ) { printf( '

%s

', $args['label']['link'], $args['label']['label'] ); // For the forums will set the page selected from the custom option `_bbp_root_slug_custom_slug`. } else { - echo ''; + echo ''; } if ( ! bp_is_root_blog() ) { @@ -162,37 +165,15 @@ public function bb_core_admin_maybe_save_readylaunch_settings() { } public function override_page_templates( $template ) { - global $post; - $enabled_pages = bb_get_enabled_readylaunch(); - $enabled_pages = wp_parse_id_list( $enabled_pages ); - - if ( - ! empty( $post->ID ) && - in_array( $post->ID, $enabled_pages, true ) - ) { - $compponent = array_search( $post->ID, $enabled_pages, true ); - if ( ! empty( $compponent ) && bp_is_active( $compponent ) ) { - $template = bp_locate_template( 'layout.php' ); - if ( $template ) { - add_action( 'wp_enqueue_scripts', array( $this, 'bb_readylaunch_enqueue' ) ); - return $template; - } - } + $template = bp_locate_template( 'layout.php' ); + if ( $template ) { + return $template; } return $template; } - - public function bb_readylaunch_enqueue() { - global $bp; - wp_enqueue_script( 'bp-api-request'); - // Enqueue CSS and JavaScript. - wp_enqueue_script( 'bb-readylaunch', $bp->plugin_url . "bp-core/js/readylaunch.js", array( 'jquery', 'wp-backbone', 'bp-api-request' ), bp_get_version() ); - } - public function add_template_stack( $stack ) { - $stylesheet_dir = get_stylesheet_directory(); $template_dir = get_template_directory(); @@ -209,7 +190,42 @@ public function add_template_stack( $stack ) { } return $stack; + } + + private function is_readylaunch_enabled() { + $enabled_pages = bb_get_enabled_readylaunch(); + + if ( + ( + bp_is_members_directory() && + ! empty( $enabled_pages['members'] ) + ) || + ( + bp_is_video_directory() && + ! empty( $enabled_pages['video'] ) + ) || + ( + bp_is_media_directory() && + ! empty( $enabled_pages['media'] ) + ) || + ( + bp_is_document_directory() && + ! empty( $enabled_pages['document'] ) + ) || + ( + bp_is_groups_directory() && + ! empty( $enabled_pages['groups'] ) + ) || + ( + bp_is_activity_directory() && + ! empty( $enabled_pages['activity'] ) + ) + ) { + return true; + } + + return false; } } From 116f84d9b01b98dad94e09a0f51ac9073d2e99d3 Mon Sep 17 00:00:00 2001 From: Chetan Satasiya Date: Thu, 26 Dec 2024 18:06:50 +0530 Subject: [PATCH 008/233] [ARCH-145] media conflict fix --- src/bp-core/classes/class-bb-readylaunch.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bp-core/classes/class-bb-readylaunch.php b/src/bp-core/classes/class-bb-readylaunch.php index d3ffde761d..5970952549 100644 --- a/src/bp-core/classes/class-bb-readylaunch.php +++ b/src/bp-core/classes/class-bb-readylaunch.php @@ -202,11 +202,13 @@ private function is_readylaunch_enabled() { ) || ( bp_is_video_directory() && - ! empty( $enabled_pages['video'] ) + ! empty( $enabled_pages['video'] ) && + bp_is_current_component( 'video' ) ) || ( bp_is_media_directory() && - ! empty( $enabled_pages['media'] ) + ! empty( $enabled_pages['media'] ) && + bp_is_current_component( 'media' ) ) || ( bp_is_document_directory() && From e5604a483fb4bec4bd4ff1ce77e268fa9bc1b4de Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Fri, 10 Jan 2025 12:29:08 +0530 Subject: [PATCH 009/233] PRJ-52 - Fixed phpcbf - Remove unwanted code - Added header/footer template for readylaunch --- src/bp-core/bp-core-actions.php | 1 - src/bp-core/bp-core-functions.php | 9 +- src/bp-core/classes/class-bb-readylaunch.php | 103 ++++++++++++++---- src/bp-core/classes/class-bp-admin.php | 92 +++++++--------- src/bp-core/js/readylaunch.js | 60 ---------- .../bp-nouveau/readylaunch/layout.php | 91 ++-------------- .../readylaunch/readylaunch-footer.php | 13 +++ .../readylaunch/readylaunch-header.php | 26 +++++ 8 files changed, 181 insertions(+), 214 deletions(-) delete mode 100644 src/bp-core/js/readylaunch.js create mode 100644 src/bp-templates/bp-nouveau/readylaunch/readylaunch-footer.php create mode 100644 src/bp-templates/bp-nouveau/readylaunch/readylaunch-header.php diff --git a/src/bp-core/bp-core-actions.php b/src/bp-core/bp-core-actions.php index ce721855c2..bf8ce5fc37 100644 --- a/src/bp-core/bp-core-actions.php +++ b/src/bp-core/bp-core-actions.php @@ -1239,7 +1239,6 @@ function bb_telemetry_load() { add_action( 'bp_init', 'bb_telemetry_load' ); - /** * Function to load readylaunch class. * diff --git a/src/bp-core/bp-core-functions.php b/src/bp-core/bp-core-functions.php index 7e02b3284f..ccf7aa8e13 100644 --- a/src/bp-core/bp-core-functions.php +++ b/src/bp-core/bp-core-functions.php @@ -7755,7 +7755,7 @@ function bb_core_get_encoded_image( $attachment_id, $size = 'full' ) { * * @since BuddyBoss 2.0.0 * - * @param $id Id of the section. + * @param string $id Id of the section. * * @return string Return icon name. */ @@ -10029,6 +10029,13 @@ function bb_pro_sso_version() { return '2.6.30'; } +/** + * Function to return enabled components for ReadyLaunch. + * + * @since BuddyBoss [BBVERSION] + * + * @return string + */ function bb_get_enabled_readylaunch() { return bp_get_option( 'bb_readylaunch', array() ); } diff --git a/src/bp-core/classes/class-bb-readylaunch.php b/src/bp-core/classes/class-bb-readylaunch.php index 5970952549..2f1a6a0ada 100644 --- a/src/bp-core/classes/class-bb-readylaunch.php +++ b/src/bp-core/classes/class-bb-readylaunch.php @@ -2,8 +2,8 @@ /** * Readylaunch class. * + * @since BuddyBoss [BBVERSION] * @package BuddyBoss\Core - * @since BuddyBoss [BBVERSION] */ defined( 'ABSPATH' ) || exit; @@ -21,7 +21,7 @@ class BB_Readylaunch { /** * The single instance of the class. * - * @since BuddyBoss [BBVERSION] + * @since BuddyBoss [BBVERSION] * * @access private * @var self @@ -58,18 +58,31 @@ public function __construct() { add_action( 'bp_admin_init', array( $this, 'bb_core_admin_maybe_save_readylaunch_settings' ), 100 ); if ( $enabled ) { - add_filter( 'template_include', array( $this, 'override_page_templates' ), 999999 ); // High priority so we have the last say here - - // Filter BuddyPress template locations. + add_filter( 'template_include', + array( + $this, + 'override_page_templates', + ), + 999999 + ); // High priority so we have the last say here. + + // Remove BuddyPress template locations. remove_filter( 'bp_get_template_stack', 'bp_add_template_stack_locations' ); + // Add Readylaunch template locations. add_filter( 'bp_get_template_stack', array( $this, 'add_template_stack' ), PHP_INT_MAX ); } } + /** + * Adds settings fields for the ReadyLaunch admin page. + * + * @since BuddyBoss [BBVERSION] + */ public function bb_core_admin_readylaunch_page_fields() { global $wp_settings_sections; + // Add the ReadyLaunch settings section. add_settings_section( 'bb_readylaunch', __( 'ReadyLaunch', 'buddyboss' ), @@ -77,20 +90,25 @@ public function bb_core_admin_readylaunch_page_fields() { 'bb-readylaunch' ); + // Get the directory pages. $directory_pages = bp_core_admin_get_directory_pages(); + + // Add an icon to the settings section if the function exists. if ( function_exists( 'bb_admin_icons' ) ) { $wp_settings_sections['bb-readylaunch']['bb_readylaunch']['icon'] = bb_admin_icons( 'bb_readylaunch' ); } + // Get the enabled ReadyLaunch pages and BuddyPress directory page IDs. $enabled_pages = bb_get_enabled_readylaunch(); $bp_pages = bp_core_get_directory_page_ids( 'all' ); $description = ''; + // Loop through each directory page and add a settings field if applicable. foreach ( $directory_pages as $name => $label ) { if ( ! empty( $bp_pages[ $name ] ) || ( - $name === 'new_forums_page' && + 'new_forums_page' === $name && ! empty( bp_get_forum_page_id() ) ) ) { @@ -106,51 +124,72 @@ public function bb_admin_readylaunch_pages_description() { } /** - * Pages drop downs callback + * Pages drop downs callback. * * @since BuddyBoss [BBVERSION] * - * @param $args + * @param array $args */ public function bb_enable_setting_callback_page_directory( $args ) { extract( $args ); + // Switch to the root blog if not already on it. if ( ! bp_is_root_blog() ) { switch_to_blog( bp_get_root_blog_id() ); } - $checked = ! empty( $enabled_pages ) && isset( $enabled_pages[ $name ] ); + $checked = ! empty( $enabled_pages ) && isset( $enabled_pages[ $name ] ); // For the button. if ( 'button' === $name ) { - printf( '

%s

', $args['label']['link'], $args['label']['label'] ); - // For the forums will set the page selected from the custom option `_bbp_root_slug_custom_slug`. + printf( + '

%s

', + esc_url( $label['link'] ), + esc_html( $label['label'] ) + ); } else { - echo ''; + printf( + '', + esc_attr( $name ), + checked( $checked, true, false ) + ); } + // Restore the current blog if switched. if ( ! bp_is_root_blog() ) { restore_current_blog(); } } + /** + * Save ReadyLaunch settings if applicable. + * + * @since BuddyBoss [BBVERSION] + * + * @return bool False if settings are not saved, true otherwise. + */ public function bb_core_admin_maybe_save_readylaunch_settings() { + // Check if the page and submit parameters are set. if ( ! isset( $_GET['page'] ) || ! isset( $_POST['submit'] ) ) { return false; } + // Check if the current page is the ReadyLaunch settings page. if ( 'bb-readylaunch' !== $_GET['page'] ) { return false; } + // Verify the nonce for security. if ( ! check_admin_referer( 'bb-readylaunch-options' ) ) { return false; } + // Save the ReadyLaunch settings if provided. if ( isset( $_POST['bb-readylaunch'] ) ) { bp_update_option( 'bb_readylaunch', $_POST['bb-readylaunch'] ); } + // Redirect to the ReadyLaunch settings page with a success message. bp_core_redirect( bp_get_admin_url( add_query_arg( @@ -164,34 +203,53 @@ public function bb_core_admin_maybe_save_readylaunch_settings() { ); } - public function override_page_templates( $template ) { - $template = bp_locate_template( 'layout.php' ); - if ( $template ) { - return $template; - } + /** + * Override the page templates. + * + * @since BuddyBoss [BBVERSION] + * + * @return string ReadyLaunch layout template. + */ + public function override_page_templates() { - return $template; + return bp_locate_template( 'layout.php' ); } + /** + * Add custom template stack for ReadyLaunch. + * + * @since BuddyBoss [BBVERSION] + * + * @param array $stack The current template stack. + * + * @return array The modified template stack with ReadyLaunch custom location. + */ public function add_template_stack( $stack ) { $stylesheet_dir = get_stylesheet_directory(); $template_dir = get_template_directory(); - $stack = array_flip($stack); + $stack = array_flip( $stack ); - unset( $stack[$stylesheet_dir], $stack[$template_dir] ); + unset( $stack[ $stylesheet_dir ], $stack[ $template_dir ] ); - $stack = array_flip($stack); + $stack = array_flip( $stack ); $custom_location = 'readylaunch'; foreach ( $stack as $key => $value ) { - $stack[$key] = untrailingslashit( trailingslashit( $value ) . $custom_location ); + $stack[ $key ] = untrailingslashit( trailingslashit( $value ) . $custom_location ); } return $stack; } + /** + * Check if ReadyLaunch is enabled for the current directory. + * + * @since BuddyBoss [BBVERSION] + * + * @return bool True if ReadyLaunch is enabled, false otherwise. + */ private function is_readylaunch_enabled() { $enabled_pages = bb_get_enabled_readylaunch(); @@ -226,7 +284,6 @@ private function is_readylaunch_enabled() { return true; } - return false; } } diff --git a/src/bp-core/classes/class-bp-admin.php b/src/bp-core/classes/class-bp-admin.php index 587f54db07..5adcc00ff8 100644 --- a/src/bp-core/classes/class-bp-admin.php +++ b/src/bp-core/classes/class-bp-admin.php @@ -370,16 +370,6 @@ public function admin_menus_components() { 'bp-credits', array( $this, 'bp_credits_screen' ) ); - - // Credits. - $hooks[] = add_submenu_page( - $this->settings_page, - __( 'ReadyLaunch™', 'buddyboss' ), - __( 'ReadyLaunch™', 'buddyboss' ), - $this->capability, - 'bb-readylaunch', - array( $this, 'bb_readylaunch_screen' ) - ); } /** @@ -542,7 +532,7 @@ public function admin_menus() { array( $this, 'bp_credits_screen' ) ); - // Credits. + // ReadyLaunch. $hooks[] = add_submenu_page( $this->settings_page, __( 'ReadyLaunch™', 'buddyboss' ), @@ -689,45 +679,6 @@ public function bp_upgrade_screen() { -
- -
-

', esc_attr__( 'Save Settings', 'buddyboss' ) ); - } else { - // Show a disabled "Save Settings" button if the current language is not the default language. - printf( '

%s

', esc_attr__( 'Save Settings', 'buddyboss' ) ); - printf( '

%s

', esc_attr__( 'You need to switch to your Default language in WPML to save these settings.', 'buddyboss' ) ); - } - } else { - printf( '

', esc_attr__( 'Save Settings', 'buddyboss' ) ); - } - ?> -
-
- - plugin_dir . 'bp-core/admin' ) . 'templates/update-buddyboss.php'; delete_option( '_bb_is_update' ); } + + /** + * Output the readylaunch screen. + * + * @since BuddyBoss [BBVERSION] + */ + public function bb_readylaunch_screen() { + ?> +
+ +
+

', esc_attr__( 'Save Settings', 'buddyboss' ) ); + } else { + // Show a disabled "Save Settings" button if the current language is not the default language. + printf( '

%s

', esc_attr__( 'Save Settings', 'buddyboss' ) ); + printf( '

%s

', esc_attr__( 'You need to switch to your Default language in WPML to save these settings.', 'buddyboss' ) ); + } + } else { + printf( '

', esc_attr__( 'Save Settings', 'buddyboss' ) ); + } + ?> +
+
+ + - -> - - - - +bp_get_template_part( 'readylaunch-header' ); - - - +if ( have_posts() ) : + /* Start the Loop */ + while ( have_posts() ) : + the_post(); -> - -
-
- HEADER -
+ the_content(); + endwhile; +endif; -
- -
-
-
    -
  • Loading...
  • -
-
-
- -
-
- FOOTER -
- - - - +bp_get_template_part( 'readylaunch-footer' ); diff --git a/src/bp-templates/bp-nouveau/readylaunch/readylaunch-footer.php b/src/bp-templates/bp-nouveau/readylaunch/readylaunch-footer.php new file mode 100644 index 0000000000..55c9d22c40 --- /dev/null +++ b/src/bp-templates/bp-nouveau/readylaunch/readylaunch-footer.php @@ -0,0 +1,13 @@ + + + + + + diff --git a/src/bp-templates/bp-nouveau/readylaunch/readylaunch-header.php b/src/bp-templates/bp-nouveau/readylaunch/readylaunch-header.php new file mode 100644 index 0000000000..62d2e01fb1 --- /dev/null +++ b/src/bp-templates/bp-nouveau/readylaunch/readylaunch-header.php @@ -0,0 +1,26 @@ + + +> + + + + + + + + + +> + +
+
+ ReadyLaunch HEADER +
+
From 3bc11769e52b3be9c3abe9f4a3096c108cf923b6 Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Fri, 10 Jan 2025 12:32:46 +0530 Subject: [PATCH 010/233] PRJ-52 - Updated return param --- src/bp-core/bp-core-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bp-core/bp-core-functions.php b/src/bp-core/bp-core-functions.php index ccf7aa8e13..c16c83d21a 100644 --- a/src/bp-core/bp-core-functions.php +++ b/src/bp-core/bp-core-functions.php @@ -10034,7 +10034,7 @@ function bb_pro_sso_version() { * * @since BuddyBoss [BBVERSION] * - * @return string + * @return array */ function bb_get_enabled_readylaunch() { return bp_get_option( 'bb_readylaunch', array() ); From fd99993ade61ba249b107d890939d32881047fc9 Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Fri, 10 Jan 2025 18:39:12 +0530 Subject: [PATCH 011/233] PRJ-52 - Register menu - Fetch messages/notifications via ajax - Folder structure updated --- src/bp-core/classes/class-bb-readylaunch.php | 177 ++++++++++++++---- .../assets/js/bb-readylaunch-front.js | 72 +++++++ .../{ => footer}/readylaunch-footer.php | 0 .../readylaunch/header/messages-dropdown.php | 39 ++++ .../header/notification-dropdown.php | 36 ++++ .../readylaunch/header/readylaunch-header.php | 57 ++++++ .../bp-nouveau/readylaunch/layout.php | 4 +- .../readylaunch/readylaunch-header.php | 26 --- 8 files changed, 345 insertions(+), 66 deletions(-) create mode 100644 src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.js rename src/bp-templates/bp-nouveau/readylaunch/{ => footer}/readylaunch-footer.php (100%) create mode 100644 src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php create mode 100644 src/bp-templates/bp-nouveau/readylaunch/header/notification-dropdown.php create mode 100644 src/bp-templates/bp-nouveau/readylaunch/header/readylaunch-header.php delete mode 100644 src/bp-templates/bp-nouveau/readylaunch/readylaunch-header.php diff --git a/src/bp-core/classes/class-bb-readylaunch.php b/src/bp-core/classes/class-bb-readylaunch.php index 2f1a6a0ada..b868718124 100644 --- a/src/bp-core/classes/class-bb-readylaunch.php +++ b/src/bp-core/classes/class-bb-readylaunch.php @@ -52,7 +52,10 @@ public static function instance() { */ public function __construct() { - $enabled = $this->is_readylaunch_enabled(); + $enabled = $this->bb_is_readylaunch_enabled(); + + // Register the ReadyLaunch menu. + $this->bb_register_readylaunch_menus(); add_action( 'bp_admin_init', array( $this, 'bb_core_admin_readylaunch_page_fields' ) ); add_action( 'bp_admin_init', array( $this, 'bb_core_admin_maybe_save_readylaunch_settings' ), 100 ); @@ -71,6 +74,91 @@ public function __construct() { // Add Readylaunch template locations. add_filter( 'bp_get_template_stack', array( $this, 'add_template_stack' ), PHP_INT_MAX ); + + add_action( 'wp_enqueue_scripts', array( $this, 'bb_enqueue_scripts' ) ); + + add_action( 'wp_ajax_bb_fetch_header_messages', array( $this, 'bb_fetch_header_messages' ) ); + add_action( 'wp_ajax_bb_fetch_header_notifications', array( $this, 'bb_fetch_header_notifications' ) ); + } + } + + /** + * Check if ReadyLaunch is enabled for the current directory. + * + * @since BuddyBoss [BBVERSION] + * + * @return bool True if ReadyLaunch is enabled, false otherwise. + */ + private function bb_is_readylaunch_enabled() { + $enabled_pages = bb_get_enabled_readylaunch(); + + if ( + ( + bp_is_members_directory() && + ! empty( $enabled_pages['members'] ) + ) || + ( + bp_is_video_directory() && + ! empty( $enabled_pages['video'] ) && + bp_is_current_component( 'video' ) + ) || + ( + bp_is_media_directory() && + ! empty( $enabled_pages['media'] ) && + bp_is_current_component( 'media' ) + ) || + ( + bp_is_document_directory() && + ! empty( $enabled_pages['document'] ) + ) || + ( + bp_is_groups_directory() && + ! empty( $enabled_pages['groups'] ) + ) || + ( + bp_is_activity_directory() && + ! empty( $enabled_pages['activity'] ) + ) + ) { + return true; + } + + return false; + } + + /** + * Register the ReadyLaunch menu. + * + * @since BuddyBoss [BBVERSION] + */ + public function bb_register_readylaunch_menus() { + + // Check if the menu exists already. + $menu_name = __( 'ReadyLaunch', 'buddyboss' ); + $menu_exists = wp_get_nav_menu_object( $menu_name ); + + // If the menu doesn't exist, create it. + $menu_id = ! $menu_exists ? wp_create_nav_menu( $menu_name ) : $menu_exists->term_id; + + // Define the theme location. + $theme_location = 'bb-readylaunch'; + + // Only register the theme location if it has not been registered already. + if ( ! has_nav_menu( $theme_location ) ) { + // Register the theme location if not already registered. + register_nav_menu( $theme_location, $menu_name ); + } + + // If the menu exists and the theme location is ready, assign the menu to the location. + $nav_menu_locations = get_theme_mod( 'nav_menu_locations', array() ); + if ( ! empty( $menu_id ) && ! isset( $nav_menu_locations [ $theme_location ] ) ) { + set_theme_mod( + 'nav_menu_locations', + array_merge( + get_theme_mod( 'nav_menu_locations', array() ), + array( $theme_location => $menu_id ) + ) + ); } } @@ -112,14 +200,22 @@ public function bb_core_admin_readylaunch_page_fields() { ! empty( bp_get_forum_page_id() ) ) ) { - add_settings_field( $name, $label, array( $this, 'bb_enable_setting_callback_page_directory' ), 'bb-readylaunch', 'bb_readylaunch', compact( 'enabled_pages', 'name', 'label', 'description' ) ); + add_settings_field( $name, $label, array( + $this, + 'bb_enable_setting_callback_page_directory', + ), 'bb-readylaunch', 'bb_readylaunch', compact( 'enabled_pages', 'name', 'label', 'description' ) ); register_setting( 'bb-readylaunch', $name, array( - 'default' => array() + 'default' => array(), ) ); } } } + /** + * ReadyLaunch pages description callback. + * + * @since BuddyBoss [BBVERSION] + */ public function bb_admin_readylaunch_pages_description() { } @@ -244,47 +340,52 @@ public function add_template_stack( $stack ) { } /** - * Check if ReadyLaunch is enabled for the current directory. + * Enqueue ReadyLaunch scripts. * * @since BuddyBoss [BBVERSION] + */ + public function bb_enqueue_scripts() { + $min = bp_core_get_minified_asset_suffix(); + + wp_enqueue_script( 'bb-readylaunch-front', buddypress()->plugin_url . "bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front{$min}.js", array( 'jquery' ), bp_get_version(), true ); + wp_localize_script( + 'bb-readylaunch-front', + 'bbReadyLaunchFront', + array( + 'ajax_url' => admin_url( 'admin-ajax.php' ), + 'nonce' => wp_create_nonce( 'bb-readylaunch' ), + ) + ); + } + + /** + * Fetch header messages. * - * @return bool True if ReadyLaunch is enabled, false otherwise. + * @since BuddyBoss [BBVERSION] */ - private function is_readylaunch_enabled() { - $enabled_pages = bb_get_enabled_readylaunch(); + public function bb_fetch_header_messages() { - if ( - ( - bp_is_members_directory() && - ! empty( $enabled_pages['members'] ) - ) || - ( - bp_is_video_directory() && - ! empty( $enabled_pages['video'] ) && - bp_is_current_component( 'video' ) - ) || - ( - bp_is_media_directory() && - ! empty( $enabled_pages['media'] ) && - bp_is_current_component( 'media' ) - ) || - ( - bp_is_document_directory() && - ! empty( $enabled_pages['document'] ) - ) || - ( - bp_is_groups_directory() && - ! empty( $enabled_pages['groups'] ) - ) || - ( - bp_is_activity_directory() && - ! empty( $enabled_pages['activity'] ) - ) - ) { - return true; - } + check_ajax_referer( 'bb-readylaunch', 'nonce' ); - return false; + ob_start(); + get_template_part( 'template-parts/unread-messages' ); + $messages = ob_get_clean(); + wp_send_json_success( $messages ); + } + + /** + * Fetch header notifications. + * + * @since BuddyBoss [BBVERSION] + */ + public function bb_fetch_header_notifications() { + + check_ajax_referer( 'bb-readylaunch', 'nonce' ); + + ob_start(); + get_template_part( 'template-parts/unread-notifications' ); + $notifications = ob_get_clean(); + wp_send_json_success( $notifications ); } } diff --git a/src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.js b/src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.js new file mode 100644 index 0000000000..41c26e6f7a --- /dev/null +++ b/src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.js @@ -0,0 +1,72 @@ +/* jshint browser: true */ +/* global bp, bbReadyLaunchFront */ +/* @version 1.0.0 */ +window.bp = window.bp || {}; + +( function ( exports, $ ) { + + /** + * [ReadLaunch description] + * + * @type {Object} + */ + bp.Readylaunch = { + /** + * [start description] + * + * @return {[type]} [description] + */ + start: function () { + + // Listen to events ("Add hooks!") + this.addListeners(); + }, + + /** + * [addListeners description] + */ + addListeners: function () { + $( document ).on( 'click', '.notification-link', this.openHeaderDropDown.bind( this ) ); + }, + + /** + * [openHeaderDropDown description] + * + * @param {[type]} e [description] + */ + openHeaderDropDown: function ( e ) { + e.preventDefault(); + + var $this = $( e.target ); + var isMessage = $this.parent().hasClass( 'bb-message-dropdown-notification' ); + var containerId = $this.parent().attr( 'id' ); + var action = isMessage ? 'bb_fetch_header_messages' : 'bb_fetch_header_notifications'; + + // Show a loading indicator. + $( '#' + containerId ).find( '.notification-list' ).html( '

Loading...

' ); + + // Perform the AJAX request. + $.ajax( { + type : 'GET', + url : bbReadyLaunchFront.ajax_url, + data : { + action: action, + nonce : bbReadyLaunchFront.nonce, + }, + success: function ( response ) { + if ( response.success && response.data ) { + // Populate the dropdown content. + $( '#' + containerId ).find( '.notification-list' ).html( response.data ); + } + }, + error : function () { + $( '#' + containerId ).find( '.notification-list' ).html( '

Failed to load data. Please try again.

' ); + } + } ); + }, + }; + + // Launch BP Zoom. + bp.Readylaunch.start(); + +} )( bp, jQuery ); \ No newline at end of file diff --git a/src/bp-templates/bp-nouveau/readylaunch/readylaunch-footer.php b/src/bp-templates/bp-nouveau/readylaunch/footer/readylaunch-footer.php similarity index 100% rename from src/bp-templates/bp-nouveau/readylaunch/readylaunch-footer.php rename to src/bp-templates/bp-nouveau/readylaunch/footer/readylaunch-footer.php diff --git a/src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php b/src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php new file mode 100644 index 0000000000..98182ba2f5 --- /dev/null +++ b/src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php @@ -0,0 +1,39 @@ + + diff --git a/src/bp-templates/bp-nouveau/readylaunch/header/notification-dropdown.php b/src/bp-templates/bp-nouveau/readylaunch/header/notification-dropdown.php new file mode 100644 index 0000000000..f7d92bab10 --- /dev/null +++ b/src/bp-templates/bp-nouveau/readylaunch/header/notification-dropdown.php @@ -0,0 +1,36 @@ + + diff --git a/src/bp-templates/bp-nouveau/readylaunch/header/readylaunch-header.php b/src/bp-templates/bp-nouveau/readylaunch/header/readylaunch-header.php new file mode 100644 index 0000000000..0861afe6f2 --- /dev/null +++ b/src/bp-templates/bp-nouveau/readylaunch/header/readylaunch-header.php @@ -0,0 +1,57 @@ + + +> + + + + + + + + + +> + +
+
+
+ + + 'bb-readylaunch', +// 'menu_id' => 'primary-menu', + 'container' => false, + 'fallback_cb' => '', + 'walker' => new BuddyBoss_SubMenuWrap(), + //'menu_class' => 'primary-menu bb-primary-overflow', + ) + ); + ?> +
+
+
+ +
+
+
+
diff --git a/src/bp-templates/bp-nouveau/readylaunch/layout.php b/src/bp-templates/bp-nouveau/readylaunch/layout.php index 9924f53d98..c5de831ca8 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/layout.php +++ b/src/bp-templates/bp-nouveau/readylaunch/layout.php @@ -5,7 +5,7 @@ * @since BuddyBoss [BBVERSION] */ -bp_get_template_part( 'readylaunch-header' ); +bp_get_template_part( 'header/readylaunch-header' ); if ( have_posts() ) : /* Start the Loop */ @@ -16,4 +16,4 @@ endwhile; endif; -bp_get_template_part( 'readylaunch-footer' ); +bp_get_template_part( 'footer/readylaunch-footer' ); diff --git a/src/bp-templates/bp-nouveau/readylaunch/readylaunch-header.php b/src/bp-templates/bp-nouveau/readylaunch/readylaunch-header.php deleted file mode 100644 index 62d2e01fb1..0000000000 --- a/src/bp-templates/bp-nouveau/readylaunch/readylaunch-header.php +++ /dev/null @@ -1,26 +0,0 @@ - - -> - - - - - - - - - -> - -
-
- ReadyLaunch HEADER -
-
From 02b55dea6ff75908ad396f5bcce08aec27d6f1fe Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Mon, 13 Jan 2025 11:41:14 +0530 Subject: [PATCH 012/233] PRJ-52 - Added escaping and applied WPCS --- .../readylaunch/header/messages-dropdown.php | 13 ++++---- .../header/notification-dropdown.php | 32 +++++++++++-------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php b/src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php index 98182ba2f5..02a04c75c9 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php +++ b/src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php @@ -12,13 +12,12 @@ ?> +
\ No newline at end of file From 7fb81f9b9cc73d5b57169c82e5eaaa782cb777a5 Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Mon, 13 Jan 2025 11:56:35 +0530 Subject: [PATCH 013/233] PRJ-52 - Update selector to load ajax --- .../bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.js b/src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.js index 41c26e6f7a..0a2cc22103 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.js +++ b/src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.js @@ -37,7 +37,7 @@ window.bp = window.bp || {}; openHeaderDropDown: function ( e ) { e.preventDefault(); - var $this = $( e.target ); + var $this = $( e.target ).closest( '.notification-link' ); var isMessage = $this.parent().hasClass( 'bb-message-dropdown-notification' ); var containerId = $this.parent().attr( 'id' ); var action = isMessage ? 'bb_fetch_header_messages' : 'bb_fetch_header_notifications'; From 1a4f5facee870d521b743f12d6f2cde091fc7cdf Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Mon, 13 Jan 2025 12:01:22 +0530 Subject: [PATCH 014/233] PRJ-52 - Generate minify file via grunt --- .../bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.min.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.min.js diff --git a/src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.min.js b/src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.min.js new file mode 100644 index 0000000000..05c8293e04 --- /dev/null +++ b/src/bp-templates/bp-nouveau/readylaunch/assets/js/bb-readylaunch-front.min.js @@ -0,0 +1 @@ +window.bp=window.bp||{},function(i){bp.Readylaunch={start:function(){this.addListeners()},addListeners:function(){i(document).on("click",".notification-link",this.openHeaderDropDown.bind(this))},openHeaderDropDown:function(n){n.preventDefault();var n=i(n.target).closest(".notification-link"),t=n.parent().hasClass("bb-message-dropdown-notification"),a=n.parent().attr("id"),n=t?"bb_fetch_header_messages":"bb_fetch_header_notifications";i("#"+a).find(".notification-list").html("

Loading...

"),i.ajax({type:"GET",url:bbReadyLaunchFront.ajax_url,data:{action:n,nonce:bbReadyLaunchFront.nonce},success:function(n){n.success&&n.data&&i("#"+a).find(".notification-list").html(n.data)},error:function(){i("#"+a).find(".notification-list").html("

Failed to load data. Please try again.

")}})}},bp.Readylaunch.start()}((bp,jQuery)); \ No newline at end of file From c9f869221fe251d9f73337915326d3aa20fd1f28 Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Mon, 13 Jan 2025 13:44:56 +0530 Subject: [PATCH 015/233] PRJ-53 - Register left side bar menus - Top ReadyLaunch Panel - Bottom ReadyLaunchPanel - Also modified code to convert array to register all menus --- src/bp-core/classes/class-bb-readylaunch.php | 51 +++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/bp-core/classes/class-bb-readylaunch.php b/src/bp-core/classes/class-bb-readylaunch.php index b868718124..94d23a1b6e 100644 --- a/src/bp-core/classes/class-bb-readylaunch.php +++ b/src/bp-core/classes/class-bb-readylaunch.php @@ -127,38 +127,41 @@ private function bb_is_readylaunch_enabled() { } /** - * Register the ReadyLaunch menu. + * Register the ReadyLaunch menus. * * @since BuddyBoss [BBVERSION] */ public function bb_register_readylaunch_menus() { + // Define the menus and their respective theme locations. + $menus = array( + 'bb-readylaunch' => __( 'ReadyLaunch', 'buddyboss' ), + 'bb-top-readylaunchpanel' => __( 'Top ReadyLaunchPanel', 'buddyboss' ), + 'bb-bottom-readylaunchpanel' => __( 'Bottom ReadyLaunchPanel', 'buddyboss' ), + ); - // Check if the menu exists already. - $menu_name = __( 'ReadyLaunch', 'buddyboss' ); - $menu_exists = wp_get_nav_menu_object( $menu_name ); - - // If the menu doesn't exist, create it. - $menu_id = ! $menu_exists ? wp_create_nav_menu( $menu_name ) : $menu_exists->term_id; + foreach ( $menus as $theme_location => $menu_name ) { + // Check if the menu already exists. + $menu_exists = wp_get_nav_menu_object( $menu_name ); - // Define the theme location. - $theme_location = 'bb-readylaunch'; + // If the menu doesn't exist, create it. + $menu_id = ! $menu_exists ? wp_create_nav_menu( $menu_name ) : $menu_exists->term_id; - // Only register the theme location if it has not been registered already. - if ( ! has_nav_menu( $theme_location ) ) { - // Register the theme location if not already registered. - register_nav_menu( $theme_location, $menu_name ); - } + // Register the theme location if it has not been registered already. + if ( ! has_nav_menu( $theme_location ) ) { + register_nav_menu( $theme_location, $menu_name ); + } - // If the menu exists and the theme location is ready, assign the menu to the location. - $nav_menu_locations = get_theme_mod( 'nav_menu_locations', array() ); - if ( ! empty( $menu_id ) && ! isset( $nav_menu_locations [ $theme_location ] ) ) { - set_theme_mod( - 'nav_menu_locations', - array_merge( - get_theme_mod( 'nav_menu_locations', array() ), - array( $theme_location => $menu_id ) - ) - ); + // If the menu exists and the theme location is ready, assign the menu to the location. + $nav_menu_locations = get_theme_mod( 'nav_menu_locations', array() ); + if ( ! empty( $menu_id ) && ! isset( $nav_menu_locations[ $theme_location ] ) ) { + set_theme_mod( + 'nav_menu_locations', + array_merge( + $nav_menu_locations, + array( $theme_location => $menu_id ) + ) + ); + } } } From ef97bce40a8c5c911d90a047927a360835e1a7ec Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Mon, 13 Jan 2025 14:21:13 +0530 Subject: [PATCH 016/233] PRJ-52 - Added code to avoid directly access file - Also update menu id and menu class for wp_nav_menu --- .../bp-nouveau/readylaunch/footer/readylaunch-footer.php | 3 +++ .../bp-nouveau/readylaunch/header/messages-dropdown.php | 3 +++ .../bp-nouveau/readylaunch/header/notification-dropdown.php | 3 +++ .../bp-nouveau/readylaunch/header/readylaunch-header.php | 6 ++++-- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/bp-templates/bp-nouveau/readylaunch/footer/readylaunch-footer.php b/src/bp-templates/bp-nouveau/readylaunch/footer/readylaunch-footer.php index 55c9d22c40..03592c658d 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/footer/readylaunch-footer.php +++ b/src/bp-templates/bp-nouveau/readylaunch/footer/readylaunch-footer.php @@ -5,6 +5,9 @@ * @package ReadyLaunch */ +// Exit if accessed directly. +defined( 'ABSPATH' ) || exit; + ?>
diff --git a/src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php b/src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php index 02a04c75c9..14ea33dfca 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php +++ b/src/bp-templates/bp-nouveau/readylaunch/header/messages-dropdown.php @@ -7,6 +7,9 @@ * @package ReadyLaunch */ +// Exit if accessed directly. +defined( 'ABSPATH' ) || exit; + $menu_link = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() ); $unread_message_count = messages_get_unread_count(); ?> diff --git a/src/bp-templates/bp-nouveau/readylaunch/header/notification-dropdown.php b/src/bp-templates/bp-nouveau/readylaunch/header/notification-dropdown.php index f2f16fcdc1..234c304fe4 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/header/notification-dropdown.php +++ b/src/bp-templates/bp-nouveau/readylaunch/header/notification-dropdown.php @@ -7,6 +7,9 @@ * @package ReadyLaunch */ +// Exit if accessed directly. +defined( 'ABSPATH' ) || exit; + $menu_link = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() ); $notifications = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ); $unread_notification_count = ! empty( $notifications ) ? $notifications : 0; diff --git a/src/bp-templates/bp-nouveau/readylaunch/header/readylaunch-header.php b/src/bp-templates/bp-nouveau/readylaunch/header/readylaunch-header.php index 0861afe6f2..1134492ec9 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/header/readylaunch-header.php +++ b/src/bp-templates/bp-nouveau/readylaunch/header/readylaunch-header.php @@ -5,6 +5,8 @@ * @package ReadyLaunch */ +// Exit if accessed directly. +defined( 'ABSPATH' ) || exit; ?> > @@ -30,11 +32,11 @@ wp_nav_menu( array( 'theme_location' => 'bb-readylaunch', -// 'menu_id' => 'primary-menu', + 'menu_id' => '', 'container' => false, 'fallback_cb' => '', 'walker' => new BuddyBoss_SubMenuWrap(), - //'menu_class' => 'primary-menu bb-primary-overflow', + 'menu_class' => 'bb-readylaunch-menu', ) ); ?> From edcb26f27f95d3f80b91c3fc484862c2b14f5282 Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Mon, 13 Jan 2025 14:24:13 +0530 Subject: [PATCH 017/233] PRJ-53 - Added code to avoid directly file access - Called left sidebar template - Added new file to load Top ReadyLaunch Panel menu in the left sidebar --- .../bp-nouveau/readylaunch/layout.php | 5 ++++ .../readylaunch/sidebar/left-sidebar.php | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php diff --git a/src/bp-templates/bp-nouveau/readylaunch/layout.php b/src/bp-templates/bp-nouveau/readylaunch/layout.php index c5de831ca8..1d580dec29 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/layout.php +++ b/src/bp-templates/bp-nouveau/readylaunch/layout.php @@ -5,8 +5,13 @@ * @since BuddyBoss [BBVERSION] */ +// Exit if accessed directly. +defined( 'ABSPATH' ) || exit; + bp_get_template_part( 'header/readylaunch-header' ); +bp_get_template_part( 'sidebar/left-sidebar' ); + if ( have_posts() ) : /* Start the Loop */ while ( have_posts() ) : diff --git a/src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php b/src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php new file mode 100644 index 0000000000..3599637bb2 --- /dev/null +++ b/src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php @@ -0,0 +1,27 @@ + + + From 2108ffacb176bc9c894284bd46a29b0df6770066 Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Mon, 13 Jan 2025 14:24:31 +0530 Subject: [PATCH 018/233] PRJ-53 - Added code to load Bottom ReadyLaunch Panel menu in the left sidebar --- .../bp-nouveau/readylaunch/sidebar/left-sidebar.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php b/src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php index 3599637bb2..253cd1851f 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php +++ b/src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php @@ -23,5 +23,15 @@ 'menu_class' => 'bb-top-readylaunchpanel-menu', ) ); + + wp_nav_menu( + array( + 'theme_location' => 'bb-bottom-readylaunchpanel', + 'menu_id' => '', + 'container' => false, + 'fallback_cb' => false, + 'menu_class' => 'bb-bottom-readylaunchpanel-menu', + ) + ); ?>
From ec595a2b2b37ad5b3b0b58294685102a99d0364c Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Mon, 13 Jan 2025 15:43:50 +0530 Subject: [PATCH 019/233] PRJ-53: Refactor ReadyLaunch Settings and Add Global Design Settings - Store ReadyLaunch settings in the $this variable to make them reusable across different parts of the code. - Register a new setting called Global Design Settings with options for Groups and Courses. - Introduce a helper function to check if Groups and Courses are enabled for the left sidebar. --- src/bp-core/classes/class-bb-readylaunch.php | 81 +++++++++++++++++--- 1 file changed, 70 insertions(+), 11 deletions(-) diff --git a/src/bp-core/classes/class-bb-readylaunch.php b/src/bp-core/classes/class-bb-readylaunch.php index 94d23a1b6e..90eac69781 100644 --- a/src/bp-core/classes/class-bb-readylaunch.php +++ b/src/bp-core/classes/class-bb-readylaunch.php @@ -28,6 +28,13 @@ class BB_Readylaunch { */ private static $instance = null; + /** + * ReadyLaunch Settings. + * + * @since BuddyBoss [BBVERSION] + */ + public $settings = array(); + /** * Get the instance of this class. * @@ -51,8 +58,8 @@ public static function instance() { * @since BuddyBoss [BBVERSION] */ public function __construct() { - - $enabled = $this->bb_is_readylaunch_enabled(); + $this->settings = bb_get_enabled_readylaunch(); + $enabled = $this->bb_is_readylaunch_enabled(); // Register the ReadyLaunch menu. $this->bb_register_readylaunch_menus(); @@ -90,34 +97,33 @@ public function __construct() { * @return bool True if ReadyLaunch is enabled, false otherwise. */ private function bb_is_readylaunch_enabled() { - $enabled_pages = bb_get_enabled_readylaunch(); if ( ( bp_is_members_directory() && - ! empty( $enabled_pages['members'] ) + ! empty( $this->settings['members'] ) ) || ( bp_is_video_directory() && - ! empty( $enabled_pages['video'] ) && + ! empty( $this->settings['video'] ) && bp_is_current_component( 'video' ) ) || ( bp_is_media_directory() && - ! empty( $enabled_pages['media'] ) && + ! empty( $this->settings['media'] ) && bp_is_current_component( 'media' ) ) || ( bp_is_document_directory() && - ! empty( $enabled_pages['document'] ) + ! empty( $this->settings['document'] ) ) || ( bp_is_groups_directory() && - ! empty( $enabled_pages['groups'] ) + ! empty( $this->settings['groups'] ) ) || ( bp_is_activity_directory() && - ! empty( $enabled_pages['activity'] ) + ! empty( $this->settings['activity'] ) ) ) { return true; @@ -181,6 +187,14 @@ public function bb_core_admin_readylaunch_page_fields() { 'bb-readylaunch' ); + add_settings_field( + 'bb_readylaunch', + __( 'Global Design Settings', 'buddyboss' ), + array( $this, 'bb_readylaunch_global_design_settings' ), + 'bb-readylaunch', + 'bb_readylaunch' + ); + // Get the directory pages. $directory_pages = bp_core_admin_get_directory_pages(); @@ -190,7 +204,7 @@ public function bb_core_admin_readylaunch_page_fields() { } // Get the enabled ReadyLaunch pages and BuddyPress directory page IDs. - $enabled_pages = bb_get_enabled_readylaunch(); + $enabled_pages = $this->settings; $bp_pages = bp_core_get_directory_page_ids( 'all' ); $description = ''; @@ -222,6 +236,27 @@ public function bb_core_admin_readylaunch_page_fields() { public function bb_admin_readylaunch_pages_description() { } + /** + * ReadyLaunch global design settings callback. + * + * @since BuddyBoss [BBVERSION] + */ + public function bb_readylaunch_global_design_settings() { + ?> + + + + + + bb_is_sidebar_enabled_for_groups() ); ?> /> +

+ bb_is_sidebar_enabled_for_courses() ); ?> /> +

+ + + settings ) && isset( $this->settings[ $name ] ); // For the button. if ( 'button' === $name ) { @@ -390,6 +425,30 @@ public function bb_fetch_header_notifications() { $notifications = ob_get_clean(); wp_send_json_success( $notifications ); } + + /** + * Check if the sidebar is enabled for groups. + * + * @since BuddyBoss [BBVERSION] + * + * @return bool True if the sidebar is enabled for groups, false otherwise. + */ + public function bb_is_sidebar_enabled_for_groups() { + + return ! empty( $this->settings['groups_sidebar'] ); + } + + /** + * Check if the sidebar is enabled for courses. + * + * @since BuddyBoss [BBVERSION] + * + * @return bool True if the sidebar is enabled for courses, false otherwise. + */ + public function bb_is_sidebar_enabled_for_courses() { + + return ! empty( $this->settings['courses_sidebar'] ); + } } } From 76a02c809d7f20f31f12dc3c0439bd2fb29e2356 Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Mon, 13 Jan 2025 16:09:12 +0530 Subject: [PATCH 020/233] PRJ-53 - Update the code to ensure functions within the class return instances, enabling better reuse and accessibility of methods inside the class. --- src/bp-core/bp-core-actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bp-core/bp-core-actions.php b/src/bp-core/bp-core-actions.php index bf8ce5fc37..e6df76ca46 100644 --- a/src/bp-core/bp-core-actions.php +++ b/src/bp-core/bp-core-actions.php @@ -1246,7 +1246,7 @@ function bb_telemetry_load() { */ function bb_load_readylaunch() { if ( class_exists( 'BB_Readylaunch' ) ) { - BB_Readylaunch::instance(); + return BB_Readylaunch::instance(); } } From 0ae5e5014ead84ed2368cfc4fdaae476589fbb5e Mon Sep 17 00:00:00 2001 From: Jitendra Banjara Date: Mon, 13 Jan 2025 16:46:22 +0530 Subject: [PATCH 021/233] PRJ-53 - List out my groups in the left sidebar - If setting is disable then 'My Groups' section not display --- .../readylaunch/sidebar/left-sidebar.php | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php b/src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php index 253cd1851f..21d2d9dc8c 100644 --- a/src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php +++ b/src/bp-templates/bp-nouveau/readylaunch/sidebar/left-sidebar.php @@ -10,6 +10,8 @@ // Exit if accessed directly. defined( 'ABSPATH' ) || exit; +$enable_groups = bb_load_readylaunch()->bb_is_sidebar_enabled_for_groups(); +$current_user_id = bp_loggedin_user_id(); ?>