I made a custom module in Drupal 7 with a simple page.
I used hook_menu to make permission :
function mymodule_menu() {
$items = array();
$items['prestart'] = array(
'title' => t('Prestart page'),
'page callback' => array('mymodule_show_page'),
'access arguments' => array('access content'),
'access callback' => 'mymodule_isUserAuthenticated',
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
The function to check if the user is authenticated :
function mymodule_isUserAuthenticated() {
if (!user_is_logged_in()) {
return FALSE;
}
return TRUE;
}
}
After I created block (admin/structure/block) and I added to the page.
Problem : If I go on the page in a private navigation tab (so not connected), I can see You are not authorized to access this page but all blocks are displayed.
How can I fix it ?