1

I am new to DRUPAL. Recently I have created a view with 3 pages. 1st page shows in the main menu . 2nd and 3rd page shows in main menu . Now I would like to display the list of the images uploaded by the user in one of that menu tab. So in order to accomplish this I have added a path like user/%/MY-images in page settings. Now if I click this menu-tab I am not getting the user id passed in the url.

My contextual filter is working fine. Only thing I need to pass the user id through the URL.

Can anybody help me out to figure the solution.

Thanks in advance

0

Once your contextual filter is set up correctly to use the UID, then you'll have to manually pass the UID as an argument in a query string parameter. Your menu tabs will not do this automatically.

Instead, you'll have to implement hook_menu_link_atler() for each menu tab link.

https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu_link_alter/7

You can use the global $user object to get the uid:

https://api.drupal.org/api/drupal/developer!globals.php/global/user/7

0

First you sure create contextual filter with default value "get default uid from url"(also if you want get logged in user you can get default value from logged in user) then test it in "preview" section. if everything work in your views correctly try clear the cache.
If not work update your question with snapshot if your contextual filter settings.

  • Thank you for your help. Yes I know I can get the user id from the current logged in user. But I need to pass the user ID in the URL. I did what you suggested but it didn't work for me.will it depend on the contextual filter "get default uid from url" ? I Want to display the user id in the url on clicking on the menu tab – nirmalya batabyal Sep 17 '14 at 18:15
  • @nirmalyabatabyal yes it means that, when you click on /user/3/master-images , then set get default uid from url , it means search in url for userid and pass it to your views filter . – Yusef Sep 17 '14 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.