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

Display the notice warning once per week #19

Merged
merged 1 commit into from
Jul 29, 2023
Merged
Changes from all commits
Commits
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
27 changes: 15 additions & 12 deletions class-bp-classic.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static function is_buddypress_supported() {
}

/**
* Displays an admin notice to explain how to install BP Classic.
* Displays an admin notice to explain BP Classic requires BuddyPress 12.0.0.
*
* @since 1.0.0
*/
Expand All @@ -188,17 +188,20 @@ public static function admin_notice() {
return false;
}

$bp_plugin_link = sprintf( '<a href="%s">BuddyPress</a>', esc_url( _x( 'https://wordpress.org/plugins/buddypress', 'BuddyPress WP plugin directory URL', 'bp-classic' ) ) );

printf(
'<div class="notice notice-error is-dismissible"><p>%s</p></div>',
sprintf(
/* translators: 1. is the link to the BuddyPress plugin on the WordPress.org plugin directory. */
esc_html__( 'BP Classic requires the %1$s plugin to be active and its version must be %2$s. Please deactivate BP Classic, activate a version of %1$s %2$s and only then, reactivate BP Classic.', 'bp-classic' ),
$bp_plugin_link, // phpcs:ignore
'<b>>= 12.0.0</b>' // phpcs:ignore
)
);
$show_notice = get_site_transient( 'bp_classic_show_notice' );

if ( ! $show_notice ) {
printf(
'<div class="notice notice-warning is-dismissible"><p>%s</p></div>',
sprintf(
/* translators: %s. is current version of BuddyPress. */
esc_html__( 'Friendly reminder: BP Classic only runs when BuddyPress version is 12.0.0 (or up). Your current version of BuddyPress is: %s. Unless you activated BP Classic in anticipation of the 12.0.0 upgrade, you can deactivate it. This information will be shown regularly (every week) and as long as your BuddyPress version is lower than 12.0.0.', 'bp-classic' ),
bp_get_version() // phpcs:ignore
)
);

set_site_transient( 'bp_classic_show_notice', true, WEEK_IN_SECONDS );
}
}

/**
Expand Down