Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.8
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Dec 2009 at 07:54 UTC
Updated:
5 Jan 2010 at 03:50 UTC
I am using User:UID as an argument with the default to User ID for logged in User. Basic validation.
The paths for the pages are:
profile (no menu)
profile/%/blogs (default tab -> normal menu path)
profile/%/newsletter (menu path)
When I go to 'profile/1' - is shows the blog page with tabs for blog and newsletter (it's correct)
When I go to 'profile' it only shows the blog page, with no tabs for the other profile pages (I would like it to show the logged in user's blog page with a tabs for blog and newsletter)
How do I correct this? I noticed that profile.module also has a menu path to 'profile' - not sure if this is creating a conflict.
Comments
Comment #1
dawehnerYou would need here tab, too.
I guess thats everything, todo.
It would be cool if you would have read http://drupal.org/node/571990 :)
Comment #2
hellomobe commentedThis is a tab - my apologies - I meant 'menu tab' not menu path. Sorry about that.
The paths for the pages are:
profile (no menu)
profile/%/blogs (default menu tab -> normal menu item)
profile/%/newsletter (menu tab)
A reminder, the tabs show fine when the argument is present, but doesn't work when the argument is not present, and should default back to the current logged in user.
Comment #3
dawehnerthe you have to provide default argument in your view.
Its really good if you read the link above. There is explained, that you should export your view.
Comment #4
hellomobe commentedPlease explain in more detail.
In my view, for each of the pages, I have the arguement User:ID -> Action to take if argument is not present: -> Provide default argument -> User ID from logged in user
Comment #5
merlinofchaos commentedThe problem here is how Drupal parses tabs. THe tabs live at profile/% which means they simply won't appear at profile/ at all. The easiest solution is to put a redirect at 'profile' to redirect to profile/XXX where XXX is the user's UID. You could do this with a bit of PHP code in the default options.
Make sure you do this only on a page display (you wouldn't want a block or something to accidentally redirect) and you might want your code to check $view->live_preview to ensure you don't redirect during preview. =)
Something along these lines in the provide default PHP code:
Comment #6
hellomobe commentedmerlinofchaos you worked the magic! Thank you - works great.