views:

108

answers:

1

Hello

I have a Drupal Menu which I created through the interface. I wish to add an entry which says

Hi, John Doe

Where John Doe is a link to the User's profile page. I would like to do this programatically or if it can be done through the interface then that would be great.

Any help is appreciated.

A: 

You cannot add HTML-ified items to the menu. Menu-items are always wrapped in an anchor tag and will filter out HTML. Changing this behaviour is technically possible, but will cause a lot of unknown side-effects.

What you want, is either a simple theme override, or a custom block (potentially without a title and with some other bullets).

You can create a block with hook_block or by simply typing the HTML, with some PHP into a new block, using the PHP-input filter. This last option is quick, but is discouraged by many people for performance and "good practices" reasons: you should not store php in your database.

EDIT: After comment about "just the name":

To insert "just the name" you simply need to create module with a hook_menu.

global $user;
$items['path/%uid'] = array(
  'title'            => $user->name',
  'description'      => 'description',
  'page callback'    => 'drupal_get_form', //Fill in the callback here: function that renders the page content.
  'page arguments'   => array(''),
  'access callback'  => '',
  'access arguments' => array(''),
  'weight'           => 0,
  'menu_name'        => 'Navigation',
  'type'             => MENU_NORMAL_ITEM,
);

Is about what you want.

berkes
OK, understood. I need the client to have the ability to control the menu. How about just a link to the name, e.g. _Ed Henderson_
Ed Henderson

related questions