When a list of user profiles (http://faculty.law.unlv.edu/profile/profile_role/Academic+Faculty) is accessed using a path alias the output is not as expected. When the page is aliased so faculty > profile/profile_role/Academic+Faculty the resulting page shows just the title "Academic+Faculty" and no contents (http://faculty.law.unlv.edu/faculty).

At first glance it seems to be profile_browse() is taking its argument from the third portion of the URL which no longer works with an aliased path.

Comments

Zen’s picture

Priority: Critical » Normal
jbrauer’s picture

Priority: Normal » Critical
wulff’s picture

Actually, I think this might be a more general problem. Here's what I have found so far:

Under 'settings >> profiles' I created a new list selection field with the following selection options:

FOO BAR
BAZ BAT

Under 'my account' I chose the item 'FOO BAR' from the list selection field. The value 'FOO BAR' is stored in the profile_values table.

When I view the 'my account' page, the text 'FOO BAR' links to http://www.drupal.local/?q=profile/profile_test/FOO+BAR.

I create a path alias 'test' pointing at the part after ?q= of the above URL: test => profile/profile_test/FOO+BAR. Now, when I go to http://www.drupal.local/?q=profile/profile_test/FOO+BAR I get the expected result (a link to my account is displayed), but when I go to http://www.drupal.local/?q=test I am presented with an empty page.

Adding a print_r statement after the switch ($field->type) block in profile_browse gives the following results.

On http://www.drupal.local/?q=profile/profile_test/FOO+BAR:

Array
(
    [0] => 2
    [1] => FOO BAR
)

On http://www.drupal.local/?q=test:

Array
(
    [0] => 2
    [1] => FOO+BAR
)

In the second case, this means that 'FOO+BAR' is plugged into the select query; this returns an empty set since the string stored in the database is 'FOO BAR'

A quick fix is to do a preg_replace('/\+/', ' ', $value) in the beginning of profile_browse (similar to what is done in taxonomy_term_page).

jbrauer’s picture

I've been trying the suggested preg_match without success. Do you mean taxonomy_term_path in the taxonomy.module (which doesn't seem to use the preg_match in 4.7) or is taxonomy_term_page somewhere else that I'm missing?

Zen’s picture

Priority: Critical » Normal

This is a non-critical issue in a non-critical module. Please explain why you believe this is critical, if you want to reset it back.

Critical = A critical bug in Drupal... not a bug critical in importance to you :)

Thanks :)
-K

jbrauer’s picture

Priority: Normal » Critical

This is an issue critical to the profile module working in the same manner as other modules. I agree the profile module is not absolutely critical, however it is a key module for many users of Drupal resulting in a critical bug.

killes@www.drop.org’s picture

Version: 4.7.0-beta4 » x.y.z
Priority: Critical » Normal
Status: Active » Needs review
StatusFileSize
new671 bytes

This is certainly not critical.

Anyway, here's a patch which needs testing.

matt westgate’s picture

Assigned: Unassigned » matt westgate

This is a path aliasing issue and I'm working on it. Patch coming for review shortly.

We need to decide how dst aliases should be stored: urlencoded or urldecoded. That's the main dilemma.

matt westgate’s picture

StatusFileSize
new2.56 KB

When saving a path alias, the system accepts urlencoded or urldecoded paths so no standard was in place. That was the problem. I've changed this so we only store urldecoded paths since the url() function encodes paths already.

On a different note, I changed the help text in profile module becuase fields marked "public" can create their own view page, not just "public fields that are listed on the member page".

dries’s picture

Code looks good to me.

jbrauer’s picture

+1 the code seems to work well.

A note for anybody encountering this issue that you have to re-add the path aliases to have it work.

jbrauer’s picture

A minor glitch... There is another system_update_174() that updates the comment tables. It works when I change this to update_175.

dries’s picture

Status: Needs review » Needs work

The patch needs to be rerolled.

dries’s picture

Status: Needs work » Fixed

Re-rolled and committed. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)