Hello and thanks for this module. I am experiencing a strange bug: I am logged in as the super admin (UID 1). When me aliases is disabled, I can go to user/#/edit (where # is the uid of any existing user) and see the user edit page like normal. When me aliases is enabled, no matter what user's UID I put in, the breadcrumb and page title shows my (admin, user #1) information instead of the user whose UID I entered.

The same thing happens if I am logged in as a different user who is also an admin: user/#/edit always show the user I am logged in as in the page title and breadcrumb.

The rest of the page is usually filled with the correct information. For example, if I go to user/10/edit when logged in as user 1, all of user 10's information will show below the incorrect breadcrumb and page title.

I have tried to trace the origin of this bug but have had no luck.

Comments

kruser’s picture

I can confirm that it isn't just for user 1, when any user edits another user's profile2 tabs it displays with wrong breadcrumbs and title.

kruser’s picture

I wrote a custom module with a form_alter script to combat this...

/**
 * Implementation of hook_form_alter().
 */
function custom_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
	// Modify User profile form
	case 'user_profile_form':
	// Breadcrumb navigation
        $breadcrumb[] = l(t('Home'), NULL);
        $breadcrumb[] = l($form['#user']->name, 'user/'.$form['#user']->uid);
	$breadcrumb[] = l(t('Edit'), 'user/'.$form['#user']->uid.'/edit');
	$breadcrumb[] = l($form['#user_category'], $form['#action'], array('absolute' => 'TRUE'));
	drupal_set_title($form['#user']->name);
	drupal_set_breadcrumb($breadcrumb);
  break;			

  }
}
roland.wells’s picture

Version: 7.x-1.0 » 7.x-1.1

Confirming this is still an issue.
Drupal 7.23
'me' Aliases 7.x-1.1

areikiera’s picture

Confirmed for me too.
Drupal 7.23
'me' Aliases 7.x-1.1

Darren Shelley’s picture

Issue summary: View changes

Experiencing this issue too.

My solution was to re-evaluate why our team was using the "me aliases" module.

The only reason the team had used "me aliases" was for the benefit of sending generic URLS in email marketing where we did not necessarily know a users UID.

E.g automatically redirecting a user under the following conditions

  • user/me/edit -> user/222/edit
  • user/me/my-newsletters -> user/222/my-newsletters

On that basis I was able to replace the entire module with a simple implementation of hook_url_inbound_alter.

The "me aliases" module does provide far more uses so this won't be applicable to every use case:

function hook_url_inbound_alter(&$path, $original_path, $path_language) {
    // Replace 'me' in user urls with the appropriate user id.
    if (preg_match('|^user/me/(.*)|', $path, $matches)) {
        global $user;
        $path = 'user/' . $user->uid . $matches[1];
    }
}
DrCord’s picture

The code in #2 worked great for me.

dweber019’s picture

Same for me. Showing username A when I'm logged in with user B. This happens for me with ga_login module tab. That's the only tab affected with this behavior.

donquixote’s picture

I am running into the same issue.

Maybe an acceptable solution (without this module) for a community site is to have two separate realms:

  • user/%user/* to view any user profile
  • user/me/* to edit / manage one's own profile and account. The router path would be user/me/*, not some crazy 'user/%me/*' wildcard argument replacement.
    In fact this does not even need to be user/me/*, it could also be just me/* or something else.
  • Optionally some redirects between the two realms.
  • user/%user/edit will be only visible to administrators. Others have to visit user/me/edit.

For instance, Facebook does separate the two.

anybody’s picture

I guess this is the same issue as described in #2868208: Incorrect user loaded by argument handler. That issue has a patch, could you please check if that solves the issue for you?

Then we could proceed over there and close this as duplicate. Otherwise I guess it's at least related.