The me alias module seems to conflict with the content profile module. It prevents the redirect that content profile uses to keep the user within the user page after submitting the edit form. Without the redirect the user is taken to the actual profile node "site.com/profile-node-title" instead of remaining at "site.com/user/*/edit/uprofile" like it should.

CommentFileSizeAuthor
#7 me.module.txt23.81 KBcdale
#3 me-510866.patch2.97 KBcdale
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cdale’s picture

Priority: Critical » Normal
Status: Active » Closed (works as designed)

There is nothing I can do about this in the me module. You will need to take this up with the content profile maintainer. The offending line of code in content profile is the following from content_profile_form_alter().

    // Customize the redirect target and buttons of our own node forms.
    if (arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'edit' || arg(2) == 'profile') {

The is_numeric(arg(1)) check in content_profile will never work with the me module, unless you use the "Redirect to UID" option, or set me to be excluded on "user/*/edit/profile", as when using me, arg(1) will never actually be numeric. The content_profile maintainer could replace the is_numeric(arg(1)) check with something like ($user = menu_get_object('user')) which should serve the same purpose, and allow the module to work with me. They could also use the following in place of the entire if check:


$item = menu_get_item();
if ('user/%/edit/profile' == $item['path']) {

I have tried to find ways to get around this to allow arg() to work with me as people expect, but short of changing the value of $_GET['q'] there is no way around it. And by changing $_GET['q'] there would be a whole lot of other issues that would be faced. Although perhaps it is an option I could investigate, but it would require some serious testing.

As this is not a bug in me, and there really is nothing more that me can do to work around this expect provide the already available "redirect to UID" option, or stop me from working for "user/*/edit/profile", I'm marking this as "By design".

cdale’s picture

Title: Conflicts with content profile. » Allow is_numeric(arg(1)) to function correctly with me.
Category: support » feature
Status: Closed (works as designed) » Needs review

Having said all that, would you be willing to test a patch that implements the change to $_GET['q']?

cdale’s picture

FileSize
2.97 KB

And the patch.

highvoltage’s picture

Holy cow, that is an in depth and quick response. I'm impressed. O_O

I'll need to read on how to apply patches before I could see if that patch fixes things.

cdale’s picture

http://drupal.org/patch/apply has some good information on how to go about applying patches.

highvoltage’s picture

I've tried to do this tonight, but being so absolutely new to patching(first attempt ever), I haven't quite been able to... Pathetic as that may be. It's really late now, so I'll take another attempt at patching with tortoiseSVN tomorrow...

EDIT: tried a bit more to figure out how to patch, but the reality is I'm just not familiar enough with the actual development side of things, and the instructions don't seem geared to an absolute newbie such as myself. If you could provide the patched module file, I can test that out, but I'm failing to figure out this patching business...

Sorry to need such hand holding x_x

cdale’s picture

FileSize
23.81 KB

Not a problem. I think the patching tutorials are geared more towards linux than windows.

I've attached my current module file. You will need to remove the .txt extension.

highvoltage’s picture

As far as I'm able to tell so far, everything on my site that is related to the me module is working correctly. The content profile redirect works, and I saw no errors in any other parts of my site.

Thank you cdale. ^_^

TripleEmcoder’s picture

Confirmed patch works and solves issue with User Protect, which also relies on arg(1) to get uid. If you are afraid that changing $_GET['q'] might brake something then I would suggest making an additional flag on the settings page to enable this feature.

arski’s picture

Hey guys,

It appears that half the issues in this module can be reduced to modules making use of arg(1) to get the id of the user.. there is a problem with this in Views, in Ubercart, in CProfile, in many other places..

Just want to confirm - is it the case that this module will never allow for the arg(1) to return the user id and at the same time work without redirecting the page to users user/$uid/pagename..?

Thanks,
Martin