【Drupal6】私の前処理機能は
function blogs_additions_preprocess_user_profile(&$variables) {
global $user;
$op = '';
$op .= l(t('Delete All My Blogs'),$_GET["q"],array('query' => 'delete=myBlogs'));
$variables['profile'] = array('content_profile' => $op);
$variables['user_profile'] = implode($variables['profile']);
}
私のhook_menuは
function blogs_additions_menu(){
$items= array();
$items['users/%?delete=myBlogs'] = array(
'page callback' => 'delete_all_blogs',
'access arguments' => array('access blogs additions'),
'type' => MENU_CALLBACK,
);
return $items;
}
そして私の delete_all_blogs()
function delete_all_blogs(){
global $user;
$sql = "SELECT nid FROM node node WHERE node.uid='".$user->uid."'AND node.type='blog'";
$result = db_query($sql);
while ($row = db_fetch_object($result)) {
//print $sql;
node_delete($row->nid);
}
drupal_set_message('test', 'test');
}
私のユーザーは、次のようにプロファイルを表示できます www.mysite.com/users/barack-obama
フックが機能していないようです。おそらく、URL で使用されている % のエラーです。機能するように汎用的に使用する方法がわかりません。