Fix for Fix for Fix for Creating a simple menu entry

  1. /*
  2.  * I'm trying to create a menu item that links to 'author/<username>', where username is the name of the logged in user.
  3.  * The menu has no callback associated, it's just a simple menu item, pointing to a view page that takes the username as an argument.
  4.  * For some reason, the menu just doesn't show. I've cleared the cache but still no luck.
  5.  * Can someone tell me what is wrong with this code?
  6.  */
  7.  
  8. function wf_menu() {
  9.   global $user;
  10.   $items['author/%wf_author'] = array(
  11.     'title' => 'My Author page',
  12.     'page callback' => 'my_page',
  13.     'page arguments' => array(1),
  14.   );
  15.   return $items;
  16. }
  17.  
  18. function wf_author_load($name) {
  19. // Do something here with the $name to find the correct user object
  20. //$account = user_load(something with $name);
  21. return $account;
  22. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.