-1

I'm feel like I'm losing my mind here. I have written a custom module and implemented hook_menu to add custom admin pages. Last week this worked perfectly - this week they stopped working then vanished altogether. I can't understand what the problem is and I can't even get simple pages to work now.

This is the code I am using.

nhs_session_judge.module

/**
 * Implements hook_menu().
 */
function nhs_session_judge_menu() {
  $items['admin/session-judging'] = array(
    'title' => 'Your judging',
    'page callback' => 'your_judging_page',
    'access arguments' => array('access administration pages'),
    'type' => MENU_NORMAL_ITEM,
  );

  return $items;
}

/**
 * Custom page callback
 */
function your_judging_page() {
  $content['raw_markup'] = array(
    '#type' => 'markup',
    '#markup' => '<p>This table shows at-a-glance the session bids you have already scored and those yet to be judged.</p>',
  );

  // …

  return $content;
}

If I use a backup of the database and visit the page, it works.

If I make a change, I get this error.

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'your_judging_page' not found or invalid function name in menu_execute_active_handler()

If I clear the cache, the menu item disappears. Visiting the page by entering the URL directly in the browser address bar just redirects to /admin.

Does anyone know what's going on here? I can't make any changes/fixes to this because as soon as I do it breaks.

1 Answer 1

0

Think I figured it out. I had a backup of the nhs_session_judge.module file in sites/all/modules/custom/bak/nhs_session_judge.module and I guess drupal was reading it instead of the sites/all/modules/custom/nhs_session_judge/nhs_session_judge.module I was working on, hence why my changes were ignored then lost.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.