Skip to content

Commit

Permalink
[REVERT-4398] PROD-6979 Platform pro validation
Browse files Browse the repository at this point in the history
  • Loading branch information
bb-yudhisthir committed May 9, 2024
1 parent a9c5638 commit 0e2ae5a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
33 changes: 25 additions & 8 deletions src/bp-core/admin/settings/bp-admin-setting-activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,10 @@ public function register_fields() {
// Allow scopes/tabs.
$this->add_field( '_bb_enable_activity_pinned_posts', __( 'Pinned Post', 'buddyboss' ), 'bb_admin_setting_callback_enable_activity_pinned_posts', 'intval' );

// remove_filter( 'bb_is_enabled_activity_schedule_posts', 'bb_is_enabled_activity_schedule_posts_filter', 999 );

$args = array();
$args['class'] = esc_attr( $pro_class );
$this->add_field( '_bb_enable_activity_schedule_posts', __( 'Schedule posts', 'buddyboss' ) . bb_get_pro_label_notice(), array( $this, 'bb_admin_setting_callback_enable_activity_schedule_posts' ), 'intval', $args );

// add_filter( 'bb_is_enabled_activity_schedule_posts', 'bb_is_enabled_activity_schedule_posts_filter', 999 );

// Allow follow.
$this->add_field( '_bp_enable_activity_follow', __( 'Follow', 'buddyboss' ), 'bp_admin_setting_callback_enable_activity_follow', 'intval' );

Expand Down Expand Up @@ -377,10 +373,31 @@ public function bb_admin_activity_comments_settings_tutorial() {
* @since BuddyBoss [BBVERSION]
*/
public function bb_admin_setting_callback_enable_activity_schedule_posts() {
?>
<input id="_bb_enable_activity_schedule_posts" name="_bb_enable_activity_schedule_posts" type="checkbox" value="1" <?php checked( bb_is_enabled_activity_schedule_posts() ); ?> />
<label for="_bb_enable_activity_schedule_posts"><?php esc_html_e( 'Allow site owners and moderators to schedule their posts', 'buddyboss' ); ?></label>
<?php

if (
function_exists( 'bb_platform_pro' ) &&
version_compare( bb_platform_pro()->version, bb_pro_schedule_posts_version(), '<' )
) {
?>
<p class="description notification-information bb-lab-notice">
<?php
echo sprintf(
wp_kses_post(
/* translators: BuddyBoss Pro purchase link */
__( 'Please update %1$s to version %2$s to use schedule posts on your site.', 'buddyboss' )
),
'<a target="_blank" href="' . esc_url( 'https://www.buddyboss.com/platform' ) . '">' . esc_html__( 'BuddyBoss Platform Pro', 'buddyboss' ) . '</a>',
esc_html( bb_pro_schedule_posts_version() )
);
?>
</p>
<?php
} else {
?>
<input id="_bb_enable_activity_schedule_posts" name="_bb_enable_activity_schedule_posts" type="checkbox" value="1" <?php checked( bb_is_enabled_activity_schedule_posts() ); ?> />
<label for="_bb_enable_activity_schedule_posts"><?php esc_html_e( 'Allow site owners and moderators to schedule their posts', 'buddyboss' ); ?></label>
<?php
}
}
}

Expand Down
11 changes: 11 additions & 0 deletions src/bp-core/bp-core-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9756,3 +9756,14 @@ function bb_mention_add_user_dynamic_link( $content ) {

return preg_replace_callback( '/{{mention_user_id_(\d+)}}/', $replace_callback, $content );
}

/**
* Function to return the minimum pro version to show notice.
*
* @since BuddyBoss [BBVERSION]
*
* @return string
*/
function bb_pro_schedule_posts_version() {
return '2.5.20';
}

0 comments on commit 0e2ae5a

Please sign in to comment.