Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion classes/controllers/FrmDashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public static function load_page() {
self::remove_admin_notices_on_dashboard();
self::load_assets();

add_filter( 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . '_page_formidable-dashboard_columns', 'FrmDashboardController::entries_columns' );
$unread_count = FrmEntriesHelper::get_visible_unread_inbox_count();

add_filter( 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-dashboard_columns', 'FrmDashboardController::entries_columns' );
add_filter( 'frm_show_footer_links', '__return_false' );
add_filter( 'screen_options_show_screen', '__return_false' );
}
Expand Down
15 changes: 1 addition & 14 deletions classes/controllers/FrmEntriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,20 +333,7 @@ private static function base_column_key( $menu_name = '' ) {
$menu_name = FrmAppHelper::get_menu_name();
}

if ( FrmAppHelper::pro_is_installed() && is_callable( 'FrmProAppHelper::get_settings' ) ) {
$settings = FrmProAppHelper::get_settings();
$inbox_badge_off = ! empty( $settings->inbox ) && ! isset( $settings->inbox['badge'] );

if ( $inbox_badge_off ) {
// When the badge is disabled, the unread count is not included in the menu name.
$unread_count = 0;
}
}

if ( ! isset( $unread_count ) ) {
$inbox = new FrmInbox();
$unread_count = count( $inbox->unread() );
}
$unread_count = FrmEntriesHelper::get_visible_unread_inbox_count();

return sanitize_title( $menu_name ) . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-entries';
}
Expand Down
20 changes: 20 additions & 0 deletions classes/helpers/FrmEntriesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -866,4 +866,24 @@ public static function get_entry_statuses() {

return $existing_entry_statuses;
}

/**
* @since x.x
*
* @return int
*/
public static function get_visible_unread_inbox_count() {
if ( FrmAppHelper::pro_is_installed() && is_callable( 'FrmProAppHelper::get_settings' ) ) {
$settings = FrmProAppHelper::get_settings();
$inbox_badge_off = ! empty( $settings->inbox ) && ! isset( $settings->inbox['badge'] );

if ( $inbox_badge_off ) {
// When the badge is disabled, the unread count is not included in the menu name.
return 0;
}
}

$inbox = new FrmInbox();
return count( $inbox->unread() );
}
}