l()
is correcting your URL to path/%2Fcategory
because it's trying to make a workable link from the string path//category
.
Your string is path//category
because $user->uid
has no value. It has no value because either you haven't pulled up a user object from global $user
or user_load()
, or your user is anonymous.
I would suggest putting checking the value of $user before calling l()
, for example:
global $user; // or $user = user_load($foo);
if ($user) {
l('Destination', 'path/'.$user->uid.'/category');
} else {
l('Destination', 'path/you-are-not-logged-in');
}