Restrict Anonymous Users from accessing/viewing a Customized Form I have created a form. The codes I used are below:

function myid_print_menu()
{
    $items = array(); 

    $items['user/%user/myid_print'] = array(
        'title' =&gt; 'Print an ID',
        'page callback' =&gt; 'myid_print_user_page',
        'page arguments' =&gt; array(1),    
        'access callback' =&gt; myid_print_user_access(),    
        'file' =&gt; 'myid_print.pages.inc',    
        'type' =&gt; MENU_LOCAL_TASK,
        'weight' =&gt; -10,
    ); 
    return $items;
}


The code of the function that allows accessing the form:

function myid_print_user_access()
{  
   if (user_access('perform_regular_task'))
   {
       return TRUE;
   }else{
       return FALSE;
   }

}


I was wondering that even if the user is not log-in the form can be access.



Looking at the module's permission:




I did not assign any permission for the anonymous user. Why it is so?
The access callback element used in hook_menu() takes a string has a value, you're supplying it the output of myid_print_user_access() which return a boolean. It should be:

'access callback' =&gt; 'myid_print_user_access',