I am creating this issue here for anyone who comes across this and feels it is a bug.

What I have done, is added a workaround for #109588: hook_user* should use $account->uid, not arg(1). so that people do not need to patch core to use this module. The downside is, that /user/me/edit will get redirected to /user/uid/edit. There is really no avoiding this at the moment.

If you want to see this problem gone, then please review the above issue and mark it as RTBC. It has already been committed to D7, so we just need to get the D6 version in. :)

If you wish to run with the above patch, then you can use the patch I've attached here to make the me module work as was originally intended. (NB: You will probably need to clear your menu cache and/or hit admin/build/modules for the patch to take effect.

Comments

ahoeben’s picture

> The downside is, that /user/me/edit will get redirected to /user/uid/edit.

Note that this is the original behavior of the pre-6 module too. And for me, it was a feature, not a bug. As is, if a not-so-tech-saffy user ('user a') wants to send a link to their own page to someone else ('user b'), they may copy/paste the /user/me link. This will only work for the user a, user b will get a different page. IMHO, the url in the address bar of the browser should be without the dynamic 'me' alias.

I originally modelled the behavior of the module after flickr.com, which also redirects flickr/photos/me to flickr/photos/aldo (provided that I am logged in with a cookie).

mr.andrey’s picture

The patch fails against the Dec.25 dev. Any chance of you re-posting it for the updated version?

I have views on user profile that rely on the uid arg, so I would really prefer /user/1/edit rather than /user/me/edit

Thanks,
Andrey.

mr.andrey’s picture

After applying the patch manually, I get this error:

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'me_user_edit_access' was given in /home/portal/includes/menu.inc on line 452.

Any ideas?

Thanks,
A.

luti’s picture

StatusFileSize
new3.29 KB

mr.andrey,

probably you've missed some line. Sometimes such messages appear also after some code changes when cache is not cleared. In any case, it works for me fine, and I am attaching my patch for Dec. 25 6.x-1.x-dev version.

---

ahoeben,

I disagree to consider this behavior as a feature. If you decide to use me instead of uid (what is more or less "cosmetic" if we are concerned just about how it looks in users browser...), it shall be consistent (I generally prefer URLs which look more logical / structured instead of just some IDs / numbers...). If you prefer uid, why to use me at all? ;-)

It is simply not logical to have me everywhere but for /user/uid/edit, as generally you don't share this address (or?).

On the other hand, it is (for me at least) extremely convenient to have a possibility to use a "general" link (as /user/me/edit) in some instructions for users or so (I am sure much more users are able to simply click on such general link to get straight to their settings - or some other content - as they are able to understand what uid is and how exactly to compose URL with it...). This functionality (ability to use "general" URLs which include uid in node content, where me is dinamically converted to uid for logged in users and to some other preset URL for anonymous users or users who don't have rights to access this content - for example to instructions about how to register etc.) shall be even in core by my opinion.

As I agree there are situations where user shall be aware of his uid also in case me is generally used (if the site owner/admin decide to use me module), I suggest to:

  • introduce an option (settable for each user, if enabled by admin option) to choose weather to use /user/me or /user/uid (so anyone can use uid generally, but if he/she clicks to some link which includes me this is dinamically replaced by a relevant uid)
  • put a link somewhere in user settings (if enabled by admin option) indicating uid also in case me is selected, with corresponding explanation about how to use it to share some personal content

So, if a web site has contents which users shall share among them (a need for personal uids to be shared), site admin can enable one or another option (or both). If not, there is no need to confuse users with more options as needed, and both options can be disabled for users.

cdale’s picture

Status: Postponed » Active

Apologies about the delayed response. I'll update a patch. I also think that ahoeben has a valid point about the user/uid vs user/me. I'm pretty sure I can make this a configurable option that will allow the site administrator to choose what they want to use on their site. I'll have a bash at it, and see what turns out. I'll report back here with my progress.

cdale’s picture

Status: Active » Postponed
StatusFileSize
new1.41 KB

I have just made quite a few additions, and I'm happy enough with it to release as a stable release. See the main project page for a list of features, as well as the release notes for 6.x-1.0.

For those who apply/have applied #109588: hook_user* should use $account->uid, not arg(1). I have attached an updated patch which you may apply, however the patch is not needed for me to work correctly.

ahoeben’s picture

It would have made sense to make it 6.x-2.0, since it is a total rewrite.

luti’s picture

Thank you, cdale.

Everything seems to work fine for me (also the patched version).

cdale’s picture

Status: Postponed » Active

This can actually be cleaned up now, but would require users to have Drupal 6.10 or greater. I might wait and see if there are any more bug reports on the 1.x branch before committing this change. I will probably make a 2.x branch for this so users on older 6.x drupal can still use the module.

cdale’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Active » Fixed
cdale’s picture

Assigned: cdale » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.