Under construction.

Creating contextual menu items

Menu Token module allows to insert tokens into menu items title and path.

We are going to create a list of all articles published by the authenticated user using the Menu Token and Views modules.

  1. Create a view with context arguments.
  2. Go to Structure > Views and create a new view named "User Articles" that show "Content" of type "Article" and has the path "/articles".

    Create user articles view

    Then we need to configure the view to shows the node title and body summary.

    Users Article Fields

    Also we need a Relationship with the author of the article to be used in the contextual filter.

    User Article auhor relationship

    The key configuration step is add a Contextual Filter for the user name. With this filter we can filter the node author.

    User article contextual filter

    When the filter is not specified in the URL the view doesn't the shows any result.

    User article contextual filter no results

    Then check the “Override title” option and use the first argument to override the title with “%1's Articles”. Change the “Case” option inside the “More” field set to Capitalize first letter.

    User article contextual filter override title

  3. Create a dynamic menu item
  4. Go to Structure > Menu, create a new menu and add new link. Check the option “Uses menu token”. Open the node Current User and pick the current-user:id options. Now that option you selected is in the path field.

Comments

BigBrother2010’s picture

I followed step by step but nothing happens, the menu link does not show up.

Last step is a bit unclear.
Check the option “Uses menu token”. Open the node Current User and pick the current-user:id options. Now that option you selected is in the path field.
So in path you only put current.user:id ?

Options: Method for Nodes and Method for Users should be left as default (disabled) ?

peezy’s picture

In the example above, Method for Users should be set to "User from context." Here's a blog post that basically follows the above example and also includes an example using "Current Node Type."

berkeley16’s picture

I do all steps.

If I put in the path: user/[current-user: mail] or anything else, the menu item always directed to q=user.

I'm going crazy!