In the user profiles on groups.drupal.org, there are two website fields: "Organization Website" on http://groups.drupal.org/user/#####/edit/Business and "Website" on http://groups.drupal.org/user/#####/edit/Personal

These fields do not link properly unless they are prefixed with http://, and there is no indication in the field description that this prefix is required. I see a large number of profiles where people don't do use the prefix, and their link links to a g.d.o path instead of the URL.

Typical behavior online when a profile asks for a website is to assume that it is an absolute URL and not require the http:// prefix, but accept it if it's given. The fields on g.d.o should behave the same way.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

fwiw, I consider this a bit of protection against idiot spammers...

It may also be just the way that the profile module works and therefore something we need to fix in core first.

Anonymous’s picture

Bad usability is not good spam protection, but it is a good way to drive away users.

greggles’s picture

Project: Drupal.org site moderators » Drupal core
Version: » 7.x-dev
Component: Groups.drupal.org » profile.module

Ok. It's really a 7.x core bug afaict.

FiNeX’s picture

This bug affects Drupal 6 too. At least an hint should be provided.

greggles’s picture

Title: website URL fields in profiles on g.d.o don't work unless prefixed with http:// » website URL fields in profiles don't work unless prefixed with http://
theunraveler’s picture

Status: Active » Needs review
FileSize
690 bytes

I made a little patch that checks to see if the link begins with 'http://' and, if it doesn't, append that to the beginning of the URL. Links that do contain 'http://' should remain untouched. I'm not sure if this is the best way to do it, but it works.

Status: Needs review » Needs work

The last submitted patch failed testing.

theunraveler’s picture

Status: Needs work » Needs review
FileSize
690 bytes

Re-uploading patch, now with Unix line endings!

Status: Needs review » Needs work

The last submitted patch failed testing.

theunraveler’s picture

Status: Needs work » Needs review
FileSize
683 bytes

Trying again...

Re-test of from comment #2297642 was requested by @user.

cburschka’s picture

Isn't cleaning up broken input one of the things we try to avoid in Drupal? It seems a better idea to pick this up in validation and prevent users from entering invalid URLs in the first place...

SamRose’s picture

pick this up in validation and prevent users from entering invalid URLs in the first place...

Drupal seems to be doing the validation already.

The funny thing is, if you DO NOT give Drupal some form of rule for what to prepend a URL with, Drupal will prepend with $base_url

So, no matter which way you cut it, Profile URL fields on a basic level, are unfinished input functionality in Drupal core.

carsonw’s picture

Is there a patch available for Drupal 6.x? If not, would you please consider providing one?

gagarine’s picture

Status: Needs review » Needs work

I think (I don't try the patch, just read it sorry) the patch on #10 have a bug. It look for "http://" and add it if it's not present. But you can have an url with "https://" or other protocol. So if we have the url "https://site.com" they become "http://https://site.com" :(.

I think if no protocol is specified in the url by the user it's a good thinks to assume is http.

What about http://us3.php.net/manual/en/function.parse-url.php ?

momper’s picture

one of the most needless bugs in drupal since years - would someone solve the problem in a smart and clean (take into account the remark of #16) way for 100$ (paypal) until monday for drupal6? i'm a themer and need a solution without hours of research ...

thanks momper

amateescu’s picture

FileSize
862 bytes

Drupal 6 does validate the url profile field, but only in the profile edit form, not in the registration one. For example, you can register with a url like www.example.com but this field will fail validation when you try to edit your profile.

After some digging around, I found out that _profile_get_fields in the profile_validate_profile function doesn't return anything on the registration form, and because I couldn't get to the bottom of this issue, i'm attaching a patch for D6 that will fix the field output using parse_url(), as suggested in #16.

amateescu’s picture

Here is a patch for D6 which also disables url validation in the profile edit form.

Since the field doesn't have any description to tell users that the protocol is required, maybe some sites will find this behaviour desirable.

momper’s picture

i hope the solution of amateescu will help someone - thanks to him ...

tomsm’s picture

#19 works great. Thank you/
I use drupal 6.20.

tomsm’s picture

Also works with 6.22.

acolyte26’s picture

Status: Needs work » Needs review

#10: profile.module.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, profile.module.patch, failed testing.

tomsm’s picture

I have found a problem with the patch #19:
When a user wants to edit its profile with required fields, he always gets the message that there are required fields, even when they are filled. So he is unable to change its profile.