How to add page argument in hook_menu for dynamic callback function? I'm using groups for my website and I would like to create functions that will work for every group.
I've created a tab configuration for every group like this.

$groups = group_load_by_type('community');
foreach($groups as $key =&gt; $value) {
  $items[CONFIG_GLOBAL_ADMIN_PATH . '/groups/' . $key] = array(
    'title' =&gt; $value-&gt;title,
    'description' =&gt; 'Group ' . $value-&gt;title,
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('myModule_group_settings_form'),
    'access arguments' =&gt; array('administer site configuration'),
    'file' =&gt; 'myModule_group.admin.inc',
    'type' =&gt; MENU_LOCAL_TASK,
    'weight' =&gt; 1,
  );
}


It's working pretty well this way, I have the config for all the groups at the path/groups/groupID which is what I want.

But I would like to add an argument to my function myModule_group_setting_form($form, &amp;$form_state) and do something like this:

'page arguments' =&gt; array('myModule_group_settings_form', $key-&gt;title),


and change my function to this :

myModule_group_setting_form($form, &amp;$form_state, $groupName)


In my function, I'm using variables so the groups can hide some informations if they want.
Actually if I want to do this, I have to create a function for every group and do something like this : 

'page arguments' =&gt; array('myModule_group_' . $key-&gt;title . '_settings_form'


And I have to create a new function every time I have a new group. Since I don't have static groups, and I may have to create others in the future, this way doesn't suits me.

Thanks for your help :)
You are creating a new menu for new group. It will be better to use dynamic arguments.

$items[CONFIG_GLOBAL_ADMIN_PATH . '/groups/%'] = array(
  'description' =&gt; 'Some Group Description',
  'page callback' =&gt; 'drupal_get_form',
  'page arguments' =&gt; array('myModule_group_settings_form', 3),
  'access arguments' =&gt; array('administer site configuration'),
  'file' =&gt; 'myModule_group.admin.inc',
  'type' =&gt; MENU_LOCAL_TASK,
  'weight' =&gt; 1,
);


and In your function :

function myModule_group_setting_form($form, &amp;$form_state, $key) {
  $groups = group_load_by_type('community');
  $value = (isset($groups[$key])) ? $groups[$key] : NULL;
  if (!$value) {
    drupal_set_title($value-&gt;title);
    // Whatever you do with $value-&gt;title;
  }
  else {
    drupal_not_found(); exit();
  }
}