I really appreciate this module because you can hide business-sensitive information - like how many users there are (e.g. if you are user 7 as opposed to user 102345 - this tells you something about how many users there are) - and it provides for friendlier, more human, URLs.

However, it doesn't seem to work with Profile2. For a user to view their profile with the profile2 module, the url is profile-[profile_machine_name]/[user] (e.g. profile-main/[user]). (Obviously "/edit" can be appended to the URL.)

I was rather hoping that I could provide a nice simple generalised link to the user profile page at /profile-main/me - however this results in the following error :-

The requested page "/profile-main/me" could not be found.

The URL "/profile-main/[uid]" works as expected.

I have tried both the current stable release (7.x-1.0 - 2011-Oct-14) and the latest dev release (7.x-1.x-dev - 2012-Jan-30) and I get the same result for both.

I don't know if this is an issue with the way the Profile2 module handles URLs (somehow I doubt it), the order in which the modules are executed, or if it should be handled by the me alias module. I wonder if it is because there is a dynamic aspect to the profile2 path?

CommentFileSizeAuthor
#9 profile2-1546992-9.patch985 bytesalamp
#8 profile2-1546992-8.patch1.92 KB__cj
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gateone’s picture

Same for me sadly. As much as I love the Profile2 module, it is one that unfortunately doesn't seem to play well with many other modules... Hoping for a fix soon!

mcfilms’s picture

Wow. That explains where the last hour of my life went.

I am having the same issue too. In fact I am finding it virtually impossible to create a link ti site.com/profile-profilename/###/edit where ### is either the ME alias, a uid token, or anything else. Were either of you able to work-around his issue? I'm starting to think I should rebuild my Profile2 form as a content type and associate it with the user.

mautumn’s picture

No work around I'm afraid. If I find one I will post it.

nohup’s picture

I have looked at the code of profile2 and they way it loads the profile to show and edit. me module expects things to happen differently then what is going on in profile2, it will take a little doing to get this working. I am going to post a path here if I can figure out.

mcfilms’s picture

Just a quick note: One can change the "weight" of modules to influence the order they execute. (I can't remember offhand if this is through the devel module.) I also don't know if that helps you nohup, but thought it worth mentioning.

spessex’s picture

I have the same problem with Profile2. It won't even accept [uid] token.

prezaeis’s picture

anyone find a fix for this?

__cj’s picture

Issue summary: View changes
Status: Active » Needs work
FileSize
1.92 KB

Profile2 doesn't use the standard %user in it menu paths - this is why me / profile don't work well together. Profile defines it's own load function so it can create the profile object if it doesn't already exist.

The small attached patch forms the beginning of support of me / profile2. Because it doesn't need to support a variety of different URLs, like the main me module has too, I think the approach can be significantly simplified.

There are a couple bits that need work before this is ready, but I'm sharing now as it might help someone. I may very well have time to do further work on this in the coming weeks.

The areas I know need attention are -

  • This patch does not support the me_redirecting
  • This module does not support tokens in the path it only supports 'me'.

I've started this as a separate module within me, if the module maintainers don't feel it's worth supporting profile2(?), I might start this as a project in it's own right.

alamp’s picture

FileSize
985 bytes

@__cj Thanks a lot!
It works after slightly correcting typo in your patch,so I'm attaching the patch to correct typos.

By the way, after applying your patch, I found out this error. Do you have any idea for this ?

Notice: Undefined index: href in menu_local_tasks() (line 2062 of /drupal/includes/menu.inc).
rolando.alevelbeyond’s picture

another solution, is to use the menu token module.. and just use the [current-user:uid] token.. although it does end up exposing the user number, but for most users, they wont notice or care.. sucks that the me module doesn't play nice with profile2..

Eric van der Staaij’s picture

@alamp you need to change the profile2_me_alias_menu_alter function for the issue in menu.inc line 2060 to be solved:

$menu[$path . '/%profile2_me_alias'] = $menu[$path . '/%profile2_by_uid'];
unset($menu[$path . '/%profile2_by_uid']);

$menu[$path . '/%profile2_me_alias/view'] = $menu[$path . '/%profile2_by_uid/view'];
unset($menu[$path . '/%profile2_by_uid/view']);

$menu[$path . '/%profile2_me_alias/edit'] = $menu[$path . '/%profile2_by_uid/edit'];
unset($menu[$path . '/%profile2_by_uid/edit']);

$menu[$path . '/%profile2_me_alias/delete'] = $menu[$path . '/%profile2_by_uid/delete'];
unset($menu[$path . '/%profile2_by_uid/delete']);

The parent item has to be set in order to build e.g. the breadcrumb bar.