Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROD-8011 #4514

Open
wants to merge 60 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
2955745
PROD-8011 - Schedule CRON job for sending anonymous usage reports to …
jitendrabanjara1991 Sep 18, 2024
c03d759
PROD-8011 - Add UUID generation and site data collection for anonymou…
jitendrabanjara1991 Sep 18, 2024
ae93501
PROD-8011 - Implemented `bb_send_usage_report_to_analytics()` to coll…
jitendrabanjara1991 Sep 18, 2024
68c3e7c
PROD-8011 - Cleanup of variables
jitendrabanjara1991 Sep 18, 2024
b242c57
Merge branch 'release' into PROD-8011
jitendrabanjara1991 Sep 19, 2024
fc085ae
PROD-8011 - Update bb_collect_site_data to include server-related inf…
jitendrabanjara1991 Sep 19, 2024
d016465
PROD-8011 - Remove `$data['site_url'] = $site_url` because we pass in…
jitendrabanjara1991 Sep 19, 2024
6b514e5
PROD-8011 - Create array and pass default param
jitendrabanjara1991 Sep 19, 2024
b2f315d
PROD-8011 - Create new class file to maintain code separately for ana…
jitendrabanjara1991 Sep 19, 2024
db9a51e
PROD-8011 - To clean up memory and properly unset the variable after …
jitendrabanjara1991 Sep 24, 2024
becc50c
PROD-8011 - Update setting name
jitendrabanjara1991 Sep 24, 2024
180546e
PROD-8011 - Add setting 'Usage'
jitendrabanjara1991 Sep 24, 2024
ffae0f9
PROD-8011 - Add remote host with dev host. Also code refactor
jitendrabanjara1991 Sep 24, 2024
d47f325
PROD-8011 - Remove unset server software
jitendrabanjara1991 Sep 24, 2024
c57a263
PROD-8011 - Update text and icon
jitendrabanjara1991 Sep 25, 2024
e6a51e3
PROD-8011 - Update name performance to advanced for newly added setting
jitendrabanjara1991 Sep 25, 2024
59b1721
PROD-8011 - Update name performance to advanced where called icon
jitendrabanjara1991 Sep 25, 2024
0b25bc7
PROD-8011 - Change tab url - performance to advanced
jitendrabanjara1991 Sep 25, 2024
5109371
PROD-8011 - Add todo to change article link
jitendrabanjara1991 Sep 25, 2024
4e81e41
PROD-8011 - Update - class name and function name as per updated sett…
jitendrabanjara1991 Sep 25, 2024
2518cdd
PROD-8011 - complete option will pull all data
jitendrabanjara1991 Sep 25, 2024
4f69591
PROD-8011 - Update var name
jitendrabanjara1991 Sep 25, 2024
6afb88e
PROD-8011 - Remove empty class attr
jitendrabanjara1991 Sep 25, 2024
f7db8f4
PROD-8011 - Code refactor - Use filter to add platform option
jitendrabanjara1991 Sep 26, 2024
e497f62
PROD-8011 - Update filter name
jitendrabanjara1991 Sep 27, 2024
0eef723
PROD-8011 - Update filter name
jitendrabanjara1991 Sep 27, 2024
01c7427
PROD-8011 - Update endpoint name
jitendrabanjara1991 Sep 27, 2024
6aec5a6
PROD-8011 - Fixed typo
jitendrabanjara1991 Sep 27, 2024
868f88a
PROD-8011 - Fixed typo
jitendrabanjara1991 Sep 27, 2024
dc8b220
PROD-8011 - Remove filter, Dont need to provide to add/update any data
jitendrabanjara1991 Sep 30, 2024
5d5e88d
PROD-8011 - Add param in the doc block comment
jitendrabanjara1991 Sep 30, 2024
2fd9043
PROD-8011 - Check app plugin enable then use app function fetch optio…
jitendrabanjara1991 Sep 30, 2024
5700733
Merge branch 'release' into PROD-8011
jitendrabanjara1991 Oct 16, 2024
8bb370c
[PROD-8011] PROD-8101 - Pass options for poll and schedule posts to d…
jitendrabanjara1991 Oct 17, 2024
5fe1f27
PROD-8011 - Remove duplicate entry
jitendrabanjara1991 Oct 17, 2024
1e6dc34
PROD-8011 - Introduce new function to get integration list
jitendrabanjara1991 Oct 17, 2024
c912c53
PROD-8011 - Update typo mistake
jitendrabanjara1991 Oct 17, 2024
94f8fdc
PROD-8011 - Pass active/inactive component to telemetry
jitendrabanjara1991 Oct 19, 2024
73f4841
PROD-8011 - Add todo to remove code when release
jitendrabanjara1991 Oct 21, 2024
770ca3c
PROD-8011 - Add todo to remove code when release
jitendrabanjara1991 Oct 21, 2024
71720f8
PROD-8011 - Telemetry disable then not need to clear cron just return…
jitendrabanjara1991 Oct 24, 2024
192ae48
PROD-8011 - Exclude temp site to send telemetry data
jitendrabanjara1991 Oct 24, 2024
31b3d3d
PROD-8011 - Add domain to exclude it
jitendrabanjara1991 Oct 24, 2024
1084845
PROD-8011 - Move function inside telemetry class
jitendrabanjara1991 Oct 25, 2024
72c9ebc
PROD-8011 - Remove unwanted line
jitendrabanjara1991 Oct 25, 2024
e8d3062
PROD-8011 Update logic and add notice
bb-yudhisthir Nov 7, 2024
902818d
[PROD-8011] Style backend notice
amincdev Nov 7, 2024
0fec9a4
[PROD-8011] Notice button spacing adjustment
amincdev Nov 7, 2024
943ff2b
PROD-8011 on settings changed to complete, send instant telemetry
bb-yudhisthir Nov 8, 2024
ea6d63f
PROD-8011 Update logic for telemetr
bb-yudhisthir Nov 8, 2024
775fcf8
PROD-8011 Fix typo
bb-yudhisthir Nov 12, 2024
88921f6
Merge branch 'release' into PROD-8011
bb-yudhisthir Nov 13, 2024
636851e
PROD-8011 logic change
bb-yudhisthir Nov 13, 2024
0ee8b05
PROD-8011 phpcs
bb-yudhisthir Nov 13, 2024
e89709d
PROD-8011 Add platform registration form
bb-yudhisthir Nov 15, 2024
c527818
PROD-8011 Custom registration URL
bb-yudhisthir Nov 15, 2024
d3fe780
PROD-8011 add esc_attr function
bb-yudhisthir Nov 15, 2024
393215e
PROD-8011 Update notice
bb-yudhisthir Nov 18, 2024
fe17500
PROD-8011 Add telemetry blog URL
bb-yudhisthir Nov 19, 2024
aaaea68
PROD-8011 update url
bb-yudhisthir Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 98 additions & 2 deletions src/bp-core/admin/settings/bb-admin-setting-performance.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class BB_Admin_Setting_Performance extends BP_Admin_Setting_tab {
* @return void
*/
public function initialize() {
$this->tab_label = esc_html__( 'Performance', 'buddyboss' );
$this->tab_name = 'bp-performance';
$this->tab_label = esc_html__( 'Advanced', 'buddyboss' );
$this->tab_name = 'bp-advanced';
$this->tab_order = 90;
}

Expand Down Expand Up @@ -56,6 +56,24 @@ public function register_fields() {
$this->add_field( 'bb_load_activity_per_request', __( 'Activity loading', 'buddyboss' ), 'bb_admin_performance_setting_activity_callback', 'intval' );
}

$this->add_section(
'bb_advanced_telemetry',
__( 'Telemetry', 'buddyboss' ), '',
array(
$this,
'bb_admin_advanced_telemetry_setting_tutorial',
)
);
$this->add_field(
'bb_advanced_telemetry_reporting',
__( 'Telemetry', 'buddyboss' ),
array(
$this,
'bb_admin_advanced_setting_telemetry_callback',
),
'string'
);

/**
* Fires to register Performance tab settings fields and section.
*
Expand All @@ -65,6 +83,84 @@ public function register_fields() {
*/
do_action( 'bb_admin_setting_performance_register_fields', $this );
}

/**
* Displays a tutorial link for telemetry settings.
*
* @since BuddyBoss [BBVERSION]
*/
public function bb_admin_advanced_telemetry_setting_tutorial() {
?>
<p>
<a class="button" href="
<?php
echo esc_url(
bp_get_admin_url(
add_query_arg(
array(
'page' => 'bp-help',
'article' => 127427, // @todo: update when release.
),
'admin.php'
)
)
);
?>
"><?php esc_html_e( 'View Tutorial', 'buddyboss' ); ?></a>
</p>
<?php
}

/**
* Outputs the telemetry setting fields.
*
* @since BuddyBoss [BBVERSION]
*/
public function bb_admin_advanced_setting_telemetry_callback() {
$bb_advanced_telemetry_reporting = bp_get_option( 'bb_advanced_telemetry_reporting', 'complete' );
?>
<fieldset>
<legend class="screen-reader-text">
<span><?php echo __( 'Complete Reporting', 'buddyboss' ); ?></span>
</legend>
<label for="full_reporting_feedback">
<input name="bb_advanced_telemetry_reporting" id="complete_reporting" type="radio" value="complete" <?php checked( $bb_advanced_telemetry_reporting, 'complete' ); ?>/>
<?php esc_html_e( 'Complete reporting', 'buddyboss' ); ?>
</label>
<p class="description">
<?php esc_html_e( 'Telemetry helps us gather usage statistics and information about your
configuration and the features and functionality you use. We aggregate this information to help us
improve our product and associate it with your customer record to help us serve you better.
We do not gather or send any of your users\' personally identifiable information.
To stop contributing towards improving the product you can disable telemetry.', 'buddyboss' ); ?>
</p>
<br>
<label for="anonymous_reporting">
<input name="bb_advanced_telemetry_reporting" id="anonymous_reporting" type="radio" value="anonymous" <?php checked( $bb_advanced_telemetry_reporting, 'anonymous' ); ?>/>
<?php esc_html_e( 'Anonymous reporting', 'buddyboss' ); ?>
</label>
<p class="description">
<?php esc_html_e( 'Telemetry helps us gather usage statistics and information about your
configuration and the features and functionality you use. We aggregate this information to help us
improve our product. By choosing anonymous reporting, your data will not be associated with your
customer record, and the way we serve you will be less relevant to you. We do not gather or
send any of your users\' personally identifiable information. If you stop contributing towards
improving the product, you can disable telemetry.', 'buddyboss' ); ?>
</p>
<br>
<label for="no_reporting">
<input name="bb_advanced_telemetry_reporting" id="disable_reporting" type="radio" value="disable" <?php checked( $bb_advanced_telemetry_reporting, 'disable' ); ?>/>
<?php esc_html_e( 'Disable telemetry', 'buddyboss' ); ?>
</label>
<p class="description">
<?php esc_html_e( 'Disabling telemetry will stop gathering and reporting usage statistics
about your configuration and the features and functionality you use. By disabling telemetry,
you will not be contributing towards the improvement of the product and the way we serve
you will be less relevant to you.', 'buddyboss' ); ?>
</p>
</fieldset>
<?php
}
}

// Class instance.
Expand Down
13 changes: 13 additions & 0 deletions src/bp-core/bp-core-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1225,3 +1225,16 @@ function bb_reset_upgrade_notice_on_admin_logut( $user_id ) {
}

add_action( 'wp_logout', 'bb_reset_upgrade_notice_on_admin_logut' );

/**
* Function to load telemetry class.
*
* @since BuddyBoss [BBVERSION]
*/
function bb_telemetry_load() {
if ( class_exists( 'BB_Telemetry' ) ) {
BB_Telemetry::instance();
}
}

add_action( 'bp_init', 'bb_telemetry_load' );
168 changes: 168 additions & 0 deletions src/bp-core/bp-core-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7916,6 +7916,9 @@ function bb_admin_icons( $id ) {
case 'bb_performance_activity':
$meta_icon = $bb_icon_bf . ' bb-icon-activity';
break;
case 'bb_advanced_telemetry':
$meta_icon = $bb_icon_bf . ' bb-icon-box';
break;
default:
$meta_icon = '';
}
Expand Down Expand Up @@ -9997,3 +10000,168 @@ function bb_get_all_headers() {

return $headers;
}

/**
* Get the telemetry platform options.
*
* @since BuddyBoss [BBVERSION]
*
* @param array $bb_telemetry_data Telemetry options.
*
* @return array Telemetry options.
*/
function bb_telemetry_platform_data( $bb_telemetry_data ) {
global $wpdb;
$bb_telemetry_data = ! empty( $bb_telemetry_data ) ? $bb_telemetry_data : array();

// Filterable list of BuddyBoss Platform options to fetch from the database.
$bb_platform_db_options = apply_filters(
'bb_telemetry_platform_options',
array(
'bb_presence_interval_mu',
'bb_presence_time_span_mu',
'bb_profile_slug_format',
'_bp_community_visibility',
'bb_reaction_mode',
'_bb_enable_activity_schedule_posts',
'_bb_enable_activity_comment_threading',
'_bb_activity_comment_threading_depth',
'_bb_enable_activity_comments',
'_bb_activity_comment_visibility',
'_bb_activity_comment_loading',
'bb_activity_load_type',
'bb_ajax_request_page_load',
'bb_load_activity_per_request',
'_bp_enable_activity_like',
'_bb_enable_activity_pinned_posts',
'_bbp_db_version',
'bp-display-name-format',
'bp-member-type-enable-disable',
'bp-member-type-display-on-profile',
'bp-disable-avatar-uploads',
'bp-disable-cover-image-uploads',
'bp-disable-group-avatar-uploads',
'bp-disable-group-cover-image-uploads',
'bp-disable-group-type-creation',
'bp-disable-account-deletion',
'bp-enable-private-network',
'bp_activity_favorites',
'bp-enable-site-registration',
'_bp_enable_activity_autoload',
'_bp_enable_activity_follow',
'_bp_enable_activity_link_preview',
'_bp_enable_activity_emoji',
'_bp_enable_activity_gif',
'bp_search_members',
'bp_search_number_of_results',
'bp_media_profile_media_support',
'bp_media_profile_albums_support',
'bp_media_group_media_support',
'bp_media_group_albums',
'bp_media_forums_media_support',
'bp_media_messages_media_support',
'_bbp_enable_favorites',
'_bbp_enable_subscriptions',
'_bbp_allow_topic_tags',
'_bbp_thread_replies_depth',
'_bbp_forums_per_page',
'_bbp_topics_per_page',
'_bbp_replies_per_page',
'_bbp_enable_group_forums',
'bp-disable-group-messages',
'bp_media_symlink_support',
'_bbp_pro_db_version',
'_bp_enable_activity_edit',
'bp_media_allowed_per_batch',
'bp_document_allowed_per_batch',
'bp_video_profile_video_support',
'bp_video_group_video_support',
'bp_video_messages_video_support',
'bp_video_forums_video_support',
'bp_video_allowed_size',
'bp_video_allowed_per_batch',
'bp_video_extension_video_support',
'bp_media_symlink_direct_access',
'bp_video_extensions_support',
'_bp_on_screen_notifications_enable',
'_bp_on_screen_notification_position',
'_bp_on_screen_notification_mobile_support',
'_bp_on_screen_notification_visibility',
'_bp_on_screen_notification_browser_tab',
'_bp_db_version',
'bb_pinned_post',
'bp_document_extensions_support',
'bp_media_profile_document_support',
'bp_media_group_document_support',
'bp_media_messages_document_support',
'bp_media_forums_document_support',
'bp_media_extension_document_support',
'bp_document_allowed_size',
'bp_media_allowed_size',
'_bb_enable_activity_post_polls',
)
);

// Added those options that are not available in the option table.
$bb_telemetry_data['bb_platform_version'] = BP_PLATFORM_VERSION;
$bb_telemetry_data['active_integrations'] = bb_active_integrations();

// Pass active or inactive components.
$components = bp_core_get_components();
$active_components = bp_get_option( 'bp-active-components' );
$inactive_components = array_diff( array_keys( $components ), array_keys( $active_components ) );
if ( ! empty( $inactive_components ) ) {
foreach ( $inactive_components as $component ) {
$active_components[ $component ] = 0;
}
}
$bb_telemetry_data['bp-active-components'] = $active_components;

// Fetch options from the database.
$bp_prefix = bp_core_get_table_prefix();
$query = "SELECT option_name, option_value FROM {$bp_prefix}options WHERE option_name IN ('" . implode( "','", $bb_platform_db_options ) . "');";
$results = $wpdb->get_results( $query, ARRAY_A );

if ( ! empty( $results ) ) {
foreach ( $results as $result ) {
$bb_telemetry_data[ $result['option_name'] ] = $result['option_value'];
}
}

unset( $bp_prefix, $query, $results, $bb_platform_db_options );

return $bb_telemetry_data;
}

/**
* Get the status of integrations.
*
* @since BuddyBoss [BBVERSION]
*
* @return array list of integrations status.
*/
function bb_active_integrations() {

$active_integrations = array(
'bp-learndash' => false,
'bb-recaptcha' => false,
);
if ( is_plugin_active( 'sfwd-lms/sfwd_lms.php' ) ) {
$options = bp_get_option( 'bp_ld_sync_settings', array() );
if (
! empty( $options['buddypress']['enabled'] ) ||
! empty( $options['learndash']['enabled'] )
) {
$active_integrations['bp-learndash'] = true;
}
}
if ( function_exists( 'bb_recaptcha_site_key' ) && ! empty( bb_recaptcha_site_key() ) ) {
$active_integrations['bb-recaptcha'] = true;
}

if ( function_exists( 'bb_pro_active_integrations' ) ) {
$active_integrations = bb_pro_active_integrations( $active_integrations );
}

return $active_integrations;
}
Loading