By paul555 on
Hi all. I successfully installed calendar module and made a calendar page ( /calendar ) showing of site events following this tutorial http://www.jmstudio.org/archives/32 .
Now i want to ask if it is possible and how to make the calendar page to be shown as a tab (like edit tab ) in each user profile instead in /calendar and also that tab to be only visible to the user that owns the profile (or i think the currently logged in user). Thanks in advance.
Comments
^
You will need to clone the View that provide calendar in /calendar path and add a 'User: User' argument.
In the settings page of this new argument, select 'provide default argument' and then 'user ID from URL' or 'logged in user' as you need.
To add a tab, you will need to give it a path like /user/%/calendar and add a menu tab. This works well if you selected ;User ID from URL'.
What's new and changing in PHP 8.4
Thank you for your reply. I
Thank you for your reply. I cloned the calendar view and then disabled it. In the new view i it set up to show the site events. I followed the following steps.
1) Override the arguments for the calendar page.
2)There i added a User: Uid argument and selected as you told me 'provide default argument' and then 'User ID from logged in user' .( i tried the same also for User: Name arg and with 'user ID from URL' option in both args).
3)Also i selected as page path '/user/%/calendar' and added a menu tab.
Now i have a calendar tab in each user profile at /user/[user-id]/calendar but it isn't saw the events. It is just gray. When i click the prev and next links i get the calendar with the events in user/2011-09/calendar/2011-09 url. Any help?
Also can i make this tab visible only to the owner of the profile?
calendar for each user
I know is too probably too late already, but perhaps for future reference. For Drupal 7, this what you can do:
- setup calendar using views. if you do not know how to do it, refer to the module documentation.
- this calendar is for all users on the site to use
if you want certain individual user to have his own calendar with listed events that he adds himself, and only him can see, and it is listed in tab menu of his user menu, then you can do this:
- clone that calendar views and rename it to something
- on the advance setting, add 'relationships' of 'content:author'
- add 'contextual filter' of 'user:uid'
- change the order of contextual filter so user:uid is listed first
- add to the path: /user/%/calendar.........../month
- do the same thing to week, day and year if you want
- on the menu, choose 'menu tab' and 'user menu'
that will display additional tab on individual user menu.
Just another note on this, If
Just another note on this,
If you are using the mini calendar block you will need to edit the contextual filter for User ID and select "Provide default value" and set it to "User ID from URL". Since blocks do not get URL's like pages do, it must be told where to grab the user id from.
Hope that helps someone!
Menu section
Hello Amysteen,
I know its been some time since this but I have an issue on the last part what link do you use on the tab menu? I've been putting user/%/mycalendar but the menu won't take this.
I would really appreciate your help
Daniela
=-=
user/%/mycalendar is used a contextual filter within a view not in a menu item
Thank you VM for your comment
Thank you VM for your comment, Do you know how will you make the link to be on the menu?
=-=
I'd likely investigate https://www.drupal.org/project/menu_token