How do I remove a menu item on a module? So there's the course module for Drupal, and I want to remove one of the form items, $form['course']['duration'].

It's setup like this.

$form['course']['duration'] = array(
    '#title' =&gt; t('Duration'),
    '#type' =&gt; 'textfield',
    '#description' =&gt; t('Length of time in seconds that a user can remain in the course. Leave blank for unlimited.&lt;br/&gt;For a better experience, install the !link module.', array('!link' =&gt; l('Time period', 'http://drupal.org/project/timeperiod'))),
  );

  if (module_exists('timeperiod')) {
    $form['course']['duration']['#type'] = 'timeperiod_select';
    $form['course']['duration']['#units'] = array(
      '86400' =&gt; array('max' =&gt; 30, 'step size' =&gt; 1),
      '3600' =&gt; array('max' =&gt; 24, 'step size' =&gt; 1),
      '60' =&gt; array('max' =&gt; 60, 'step size' =&gt; 1),
    );
    $form['course']['duration']['#description'] = t('Length of time that a user can remain in the course.');
  }


How could I remove this from the module? I don't want non-admin users to be able to modify this. I obviously don't want to hack the core of the module.

Would I just rewrite the function? Is there anyway to do this?
This is an option in a form. You can use hook form alter in your custom module to hide it. For example

function my_module_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'SOME_FORM_ID') { 
    // you need to find out the form id . You can do so by adding a 
    // print line or (dpm($form_id)) in the ..._form function in the Course module.
    $form['course']['duration']['#access'] = FALSE;
   }
 }