Now that we have our basic module stubbed out, we will begin by registering a URL for the new page that we are going to create.
Our module will only need to register one new page. This is the page that will manage the email composition form. In the last chapter, we registered a JSON handler by implementing the hook_menu()
function. We will use the same hook here as well. This time we are creating a page intended to be accessed by an administrative user.
/** * Implementation of hook_menu() */ function emailusers_menu() { // Need to pass User ID here: $items['admin/emailusers/compose/%'] = array( 'title' => 'Compose a Message', 'page callback' => 'emailusers_compose', 'page arguments' => array(3), // <- userID (from % in node path) 'access arguments' => array('administer users'), 'type' => MENU_CALLBACK, ); return $items; }
As you may recall from the last chapter, the purpose of the menu hook is to register a URL. When we register a URL...