[development] url as callback argument

cooper Quintin cooperq at cooperq.com
Tue Feb 3 10:34:35 UTC 2009

Hello all,
I am writing a module and I am trying to use a url as a callback
argument, but it does not work.  Here is the code:

$items[] = array(
    'path' => 'admin/settings/featured-comments/feature',
    'title' => t('featured comment'),
    'callback' => 'feature_comment',
    'callback_args' => $_GET['cid'],
    'access' => user_access('administer comments'),
    'type' => MENU_CALLBACK

and the callback function:
function feature_comment($cid) {
  $comment = _comment_load($cid);
  db_query("UPDATE {featured_comments} SET featured=1 WHERE cid=%d", $cid);

going to an example url:
gives the following error: warning: Missing argument 1 for
feature_comment() in
on line 149.

So my question is, what is the best way to use parts of the linked url
as a callback argument for a function, because obviously it is not what
I am doing!

Cooper Quintin
Freelance Programmer, Indymedia Journalist
(510) 827-5382

More information about the development mailing list