2

I am trying to create a simple module that add a button in the admin/config menu. I need the button to run a php script on click. So far I've browsed dozens tutorials, but I am not able even to see the enabled module in admin/config menu as an item (even though I have used code which should just redirect to node/1).

Here is the code I have used:

function send_reminders_menu() {

$items['admin/config/reminders'] = array(
    'title' => 'Reminders Control Panel',
    'page callback' => 'drupal_goto',
    'page arguments' => array('node/1'),
    'access arguments' => array('access reminders control panel'),
    'weight' => 50,
    'type' => MENU_LOCAL_TASK,
  );
  return $items;

1 Answer 1

2

Change MENU_LOCAL_TASK to MENU_NORMAL_ITEM.

MENU_LOCAL_TASK expects the one-level_up menu router item to be as a MENU_DEFAULT_LOCAL_TASK but admin/config isn't. MENU_NORMAL_ITEM adds a normal menu item.

Lastly, don't forget to clear caches when you've made changes. Good luck!

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, I did that, but it seems that there is another problem, for the menu item is still not visible. Interesting thing is that when I type the path at the address bar "/admin/config/reminders" - there is an error: "Access Denied. You are not authorized to access this page."
@user2056853 You have a permissions problem then - make sure you're actually defining access reminders control panel in hook_permission(), and that the user account you're trying to access the page with has that permission assigned

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.