Question has been asked on Drupal Answers and in the end, i was advised not to use it as path generator which is silly, since Realname as explained in documentation is here for privacy too, to hide username and show some other field.
Therefore i find this major issue as link generation must be done with realname field too, otherwise link reveals user name or mail or some other field. Point in realname in links is to have nice links not some random numbers with names etc. Not only they look nice, its nice for SEO if we set up links with logical names.

So here is the problem and the question:

Contextual is set up to display all content from a user for a specific content type.
www.example.com/users/realname/gallery where realname is contextual filter.
Realname is used with token that reflects field from registration: field-choose-realname.

Lets say we have 2 users and 1st writes "One" as realname and 2nd writes "One Two".
Realname contextual filter is setup to use lowercase and change spaces to dash.

Here is what happens:
www.example.com/users/one/gallery - ok
www.example.com/users/one-two/gallery - page not found error
www.example.com/users/one%20two/gallery - ok

For Contextual "when the filter is in the URL or a default is provided" i am using this php code (i did not write it so i have no clue what it does really):

if (!isset($argument)) {
return FALSE;
}
$query = db_query('SELECT uid, realname FROM {realname} WHERE realname = :realname', array(':realname' => $argument));
$row = $query->fetchAssoc();
if (isset($row['uid'])) {
return TRUE;
}
return FALSE;

I also use contextual block with links to various user contents like gallery, bio, videos etc. All work fine if use has only one word setup as realname.

Comments

BigBrother2010 created an issue. See original summary.

BigBrother2010’s picture

Issue summary: View changes