Is there a better way to make a user profile tab using a view? I have created a question node type using CCK and would like to show all of the questions which users create on a tab on their profile page.

The way I have done this feels a little indirect. I have:


Created a view which lists all of a user's questions and made a block to display it.
Configured the block so that it only displays on the right path ("user/*/questions").
Created an entry in hook_menu for this path. Used a page callback which calls a function which creates an empty page (see below).


Is there a more direct way to do this by, e.g., attaching the view directly to the profile page?

The code in hook_menu() is:

$items['user/%/questions'] = array(
  'title'            =&gt; 'Your Questions',
  'description'      =&gt; 'User Questions',
  'page callback' =&gt; 'answers_blank_page',
  'access arguments'  =&gt; array('create question content'),
  'type'     =&gt; MENU_LOCAL_TASK,
  'weight' =&gt; 9,
);


The page callback is simply:

function answers_blank_page () {
  return '';
}
There isn't any need to use a custom module for this: The Views module already allows you to associate a URL to a view and make the view appears as a menu tab.  

The following screenshots are for Views 7.x-3.x-dev, but the settings are present also in previous versions of the module.
Under "Page settings," there are two options: "Path" and "Menu." The screenshots shows the settings used for a view implemented by a third-party module (the Flag module), whose view is shown as menu tab.