Okay, using Groupadmin 2.1. I navigate to the tab to update a user's membership. I get this in the URL:

aaee/og/groupadmin/179/add/4/Paul User?destination=%2Faaee%2Fnode%2F179%2Fgroupadmin

Where "aaee" is the subdirectory where this testbed is installed, 179 is the group's node # and "Paul User" is my fake test account.

When I hit "add" on this page to confirm that I want to add Paul User to a group, I get a "Bad Request" (400 error) from my server. I end up landing at:

aaee//aaee/node/179/groupadmin

Obviously the module is miswriting the destination= value, probably because I'm doing this on a subdirectory installation.

Comments

pbeakley’s picture

Quick addendum: The function actually did succeed in adding the (fake) user to the group, so it's just the post-function redirect that doesn't work (on a subdirectory installation).

andy inman’s picture

Assigned: Unassigned » andy inman

Ok, thanks for that. Yep, the ?destination value is wrong, obviously. I thought I was setting it based on active path, but it seems not. I'll fix it.

andy inman’s picture

Ok, now I've checked, I'm rather mystified why it doesn't work. The destination url is set from request_uri() which should be the current url (before you click the "add" link etc.) In other words you should end up back where you came from. It seems request_uri() is not returning the right value. Is this Apache, and what OS? I'm wondering if its some server configuration thing, because request_uri() ought to work (it's a built-in Drupal function.)

andy inman’s picture

Further thought, when you float your mouse pointer over an "add" or "remove" link (etc), is the correct url shown in the browser status bar? The ?destination part should be the current url without the http://example.com part.

pbeakley’s picture

Hey, sorry I'm just now getting back to you on this. This is running on Apache. Not sure how to dig deeper on the server configuration -- is there anything specific about the settings I can look up for you? My apologies for not being more immediately helpful; server stuff is usually beyond me.

I uninstalled Groupadmin and reverted to the built-in tools you get via Group Details block but let me reload it and see what happens.

EDIT: Just reinstalled and gave it a quick runthrough. Unfortunately I can't see what link is in the mouseover because it's the page that is fed when I hit "add," "remove" or "cancel" buttons. Mousing over the buttons doesn't give me a preview of the URL in the status line of my browser. :-/

andy inman’s picture

Can you somehow display request_uri() - e.g. create a node with the PHP filter and do:

print '1: request_uri() returns: ' . request_uri();
unset($_SERVER['REQUEST_URI']);
print '2: request_uri() returns: ' . request_uri();

It seems it's not going to include the subdirectory part. The second one might do it correctly (see http://api.drupal.org/api/function/request_uri/6).

I'd like to get this fixed and move on - I've been doing a lot of Drupal module work this week, but need to get back to paid work!

andy inman’s picture

Hmm... further thought - maybe it's me getting it wrong! Wondering if I should be using url() instead...

Please try this:

print '1: request_uri() returns: ' . request_uri();
print '2: url(request_uri()) returns: ' . url(request_uri());
andy inman’s picture

Ok, forget all the above! I think I've fixed it. Now using the drupal function drupal_get_destination which I think will give you the correct result. Please try replacing your installed .module with this one. If it works I'll make a new release.

andy inman’s picture

Status: Active » Needs review
pbeakley’s picture

Sweet, thank you! I'll check it out this week.

Thanks for the hard work!

p.

andy inman’s picture

Status: Needs review » Fixed

Fixed in 2.2.

Status: Fixed » Closed (fixed)

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