<br><br><div class="gmail_quote">On Tue, Feb 3, 2009 at 11:34 AM, cooper Quintin <span dir="ltr"><<a href="mailto:cooperq@cooperq.com">cooperq@cooperq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello all,<br>
I am writing a module and I am trying to use a url as a callback<br>
argument, but it does not work. Here is the code:<br>
<br>
$items[] = array(<br>
'path' => 'admin/settings/featured-comments/feature',<br>
'title' => t('featured comment'),<br>
'callback' => 'feature_comment',<br>
'callback_args' => $_GET['cid'],<br>
'access' => user_access('administer comments'),<br>
'type' => MENU_CALLBACK<br>
);<br>
<br>
and the callback function:<br>
function feature_comment($cid) {<br>
$comment = _comment_load($cid);<br>
db_query("UPDATE {featured_comments} SET featured=1 WHERE cid=%d", $cid);<br>
drupal_goto("node/$comment->nid");<br>
}<br>
</blockquote></div><br><br>I think you can bypass the problem loading the $_GET in feature_comment function and obviously setting $cid = NULL, so:<br><br>function feature_comment($cid = NULL) {<br> if (!isset($cid)) {<br>
if (!$cid = $_GET['cid']) {<br> drupal_goto();<br> }<br> }<br>
$comment = _comment_load($cid);<br>
db_query("UPDATE {featured_comments} SET featured=1 WHERE cid=%d", $cid);<br>
drupal_goto("node/$comment-><div class="Ih2E3d">nid");<br>}</div><br><br clear="all"><br>-- <br>Paolo Mainardi<br><br>Vice Presidente Assoc.ILDN (<a href="http://www.ildn.net">http://www.ildn.net</a>)<br>Blog: <a href="http://www.paolomainardi.com">http://www.paolomainardi.com</a><br>