v4.8.1 #3
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user