Show menu only when user ticks the checkbox I have a menu for user to enter user details which should visible only to logged in user, it works fine. Now I want to add another restriction where I want menu to be displayed only to the user who ticked the checkbox during registration (i.e.,) In registration form there will be a checkbox when user tick the checkbox the menu should be visible otherwise menu should not be accessed by use. I tried following code but not working.

 function my_module_form_alter(&amp;$form, &amp;$form_state, $form_id) {
   if($form_id = 'user_register_form'
   $form['checkbox1'] = array (
      '#title' =&gt; 'XYZ',
      '#type' =&gt; 'checkboxes',
      '#options' =&gt; array('Sell themes'),

   );
 }
 function my_module_user_register_form_submit_handler($form, &amp;$form_state) {
   $check = $form_state['complete form']['checkbox1'][0]['#checked'];
 }
 function check() {
   if($check !== 1) {
   return TRUE;
   }
   return FALSE;
 } 
 function my_module_menu_alter(&amp;$items){
   $items['node/add/detail']['access callback'] = 'check';
   $items['node/add/detail']['access arguments'] = array(1);
 }


$check return 1 if checkbox is ticked. But it is not working. Please Correct my mistake. Thank You
Go to admin/config/people/accounts/fields and add a boolean field.
In your MYMODULE_form_alter() add a '#type' =&gt; 'checkbox' form field and a custom submit handler.
Inside that custom submit handler save the checkbox value into the user's boolean field from step 1.
Inside your MYMODULE_menu_alter() call global $user and check that field's value $user-&gt;field_sell_themes and build the access control accordingly.