Index: blogroll.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/blogroll/blogroll.module,v retrieving revision 1.4 diff -u -F^fun: -r1.4 blogroll.module --- blogroll.module 11 Jan 2005 01:29:36 -0000 1.4 +++ blogroll.module 11 Jan 2005 01:51:34 -0000 @@ -28,10 +28,6 @@ $items = array(); if ($may_cache) { - $items[] = array('path' => 'blogroll/edit', 'title' => t('edit blogroll'), - 'callback' => 'blogroll_edit', - 'access' => user_access('edit own blog'), // depends on blog.module - 'type' => MENU_CALLBACK); $items[] = array('path' => 'blogroll/script', 'title' => t('blogroll'), 'callback' => 'blogroll_script', 'access' => TRUE, @@ -41,9 +37,28 @@ } /** + * Implementation of hook_categories(). + */ +function blogroll_categories() { + return array(array('name' => 'blogroll', 'title' => t('blogroll'), 'weight' => 2)); +} + +/** + * Implementation of hook_user(). + */ +function blogroll_user($type, &$edit, &$user, $category = NULL) { + switch ($type) { + case 'edit': + return blogroll_edit($user); + case 'categories': + return blogroll_categories(); + } +} + +/** * Menu callback; form for editing one's blogroll. */ -function blogroll_edit($uid = 0) { +function blogroll_edit() { global $user; $edit = $_POST['edit']; @@ -71,7 +86,7 @@ array('data' => ''. $roll->name .'', 'class' => 'rolled_blogs'), array('data' => $roll->weight, 'class' => 'weight'), // weight: +-10 , see modules/block.module for how to do it well. - array('data' => form($form, 'post', url('blogroll/edit')), 'class' => 'actions') + array('data' => form($form, 'post', url('user/'. arg(1) .'/edit/blogroll')), 'class' => 'actions') ); } if (!$rows) { @@ -89,9 +104,9 @@ $form .= form_textfield(t('Blog name'), 'name', $edit['name'], 64, 64); $form .= form_submit(t('Add blog')); $form .= "\n"; - $output .= form($form, 'post', url('blogroll/edit')); + $output .= form($form, 'post', url('user/'. arg(1) .'/edit/blogroll')); - print theme('page', $output); + return theme('page', $output); } /** @@ -113,7 +128,7 @@ } $output .= t(''); if ($user->uid == $request_uid) { // owner viewing own blog - $output .= ''; + $output .= ''; } $block['subject'] = t('Blogroll'); $block['content'] = $output;