URL to reach Workspace from non "Navigation" menu
khawaja - February 18, 2009 - 03:22
| Project: | Workspace |
| Version: | 6.x-1.x-dev |
| Component: | Documentation |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Jump to:
Description
Workspace 6.x-1.x-dev (2008-Aug-07)
// $Id: workspace.module,v 1.35 2008/08/07 02:49:45 jvandyk Exp $
Drupal 6.9, php and mysql 5
I'm using a custom menu and I'd like to put in a link to a users workspace. http://example.com/workspace produces a Page not found error. I can't create an alias since /workspace doesn't actually exist / work. I don't think workspace or the menu system is Tokenized so I can't use %uid or [uid]. So, how can I create a link in my custome menu to dynamically get to a users workspace?
From what I saw in the code, I think /workspace is supposed to work but I'm not sure.

#1
Confirmation:
In Drupal 5, the /workspace link worked. Now that I have upgraded to Drupal 6, it gives a Page Not Found error. The Admin, for example, now needs a link like /workspace/1 to get the My Workspace page.
Addition: Okay, based on getting the uid, this link works: /workspace/?q=user. However, since in my custom theme it is tied to: print l("Workspace","workspace/?q=user"), I was getting an escaped URL: workspace/%3Fq%3Duser, which required this fix to core in common.inc: www.drupal.org/node/81447
Has anyone found a better fix for this? The above is too ugly.
#2
Hi,
You can move the existing menu entry to another menu. Just go to Site building > Menus > Navigation, search for the "My workspace" entry and click on "edit". On the edit page you can change the Parent item from "Navigation" to another menu of you liking.
On my development machine that did the trick. The module does seem to care for adding the user ID.
The module uses the following code for creating the menu link:
<?php/**
* Implementation of hook_menu().
*
*/
function workspace_menu() {
$items['workspace/%user_uid_optional']
...
?>
The wildcard loader %user_uid_optional from Drupal core automatically creates the menu link, see http://drupal.org/node/209056 for details.
hth
Frank
#3
Thanks for the info and links. I had hardcoded the workspace link for Drupal 5 (and that's why workspace/%user_uid_optional did not work when I tried it), but I guess I'll have to make a new menu for Drupal 6.
#4
Seems to be related to updating from D5 to D6, see #353278: Workspace not showing up in Navigation menu. Marking this a duplicate.
Frank