Update routines

This commit is contained in:
Thomas Günther 2024-08-10 22:13:57 +02:00
parent f9238eef72
commit 138b3859aa

View File

@ -42,7 +42,7 @@ class MainController
{
global $dbHandler, $wpdb;
$show_menu = false;
$no_events = true;
foreach ( [ self::KOMPASS_EVENTS_EVENTS ] as $table ) {
$sqlTable = $wpdb->prefix . $table;
@ -50,13 +50,15 @@ class MainController
$result = $wpdb->get_var( $sql );
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(
__( 'Events (legacy)', BDP_LV_PLUGIN_SLUG ),
@ -78,14 +80,9 @@ class MainController
[ $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()