Skip to content

Instantly share code, notes, and snippets.

@martsie
Created January 25, 2017 10:22
Show Gist options
  • Save martsie/56e4c6850ea19ea5cfc637b9663a9684 to your computer and use it in GitHub Desktop.
Save martsie/56e4c6850ea19ea5cfc637b9663a9684 to your computer and use it in GitHub Desktop.
Page access controls in Drupal 7
<?php
/**
* Implements hook_menu().
*
* Defines custom pages on the site.
*/
function my_custom_module_menu() {
$items['my-custom-page'] = array(
'title' => 'My custom page',
'page callback' => 'my_custom_module_custom_page',
'access arguments' => array('my custom permission'),
);
return $items;
}
/**
* Custom page callback.
*/
function my_custom_module_custom_page() {
return 'You have successfully reached the custom page';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment