v4.8.1 #3

Merged
th.guenther merged 14 commits from v4.8.1 into main 2024-08-12 15:51:56 +02:00
Showing only changes of commit 138b3859aa - Show all commits

View File

@ -42,7 +42,7 @@ class MainController
{ {
global $dbHandler, $wpdb; global $dbHandler, $wpdb;
$show_menu = false; $no_events = true;
foreach ( [ self::KOMPASS_EVENTS_EVENTS ] as $table ) { foreach ( [ self::KOMPASS_EVENTS_EVENTS ] as $table ) {
$sqlTable = $wpdb->prefix . $table; $sqlTable = $wpdb->prefix . $table;
@ -50,13 +50,15 @@ class MainController
$result = $wpdb->get_var( $sql ); $result = $wpdb->get_var( $sql );
if ( $result == $sqlTable ) { if ( $result == $sqlTable ) {
$show_menu = true;
$no_events = 0 === $dbHandler->countSqlRows( self::KOMPASS_EVENTS_EVENTS, [ 'archived' => false ] );
} }
} }
if (!$show_menu) {
return; if ( !$no_events ) {
}
add_menu_page( add_menu_page(
__( 'Events (legacy)', BDP_LV_PLUGIN_SLUG ), __( 'Events (legacy)', BDP_LV_PLUGIN_SLUG ),
@ -78,14 +80,9 @@ class MainController
[ $this, 'router' ] ); [ $this, 'router' ] );
} }
add_submenu_page(
'kompass-events',
__('New Event', BDP_LV_PLUGIN_SLUG),
__('New Event', BDP_LV_PLUGIN_SLUG),
'show_groups',
'kompass-events&action=new-event',
[ $this, 'router' ]);
} }
}
public function router() public function router()