After submitting an email on the /contact page, I see the following notice:

notice: Undefined index: copy in /web/test/modules/contact/contact.pages.inc on line 132.

Of interest: UID 1 is apparently limited in the number of messages it can send per hour just as any other user; I'm not certain if this is a feature or a bug, but likely it belongs in a different issue, if there isn't one already.

Comments

greggles’s picture

Title: Notice on /contact page » Notice on /contact page and contact form only works for logged in users
Priority: Minor » Normal

Were you an anonymous user when that happened or a logged in one?

I only get the error if I'm anonymous.

This I created a patch which avoids this error, but then got new errors from lines seems to block the anonymous user:

notice: Undefined property: stdClass::$mail in /home/.beanor/knaddiso/d6/modules/contact/contact.pages.inc on line 174.
notice: Undefined property: stdClass::$name in /home/.beanor/knaddiso/d6/modules/contact/contact.pages.inc on line 178.

So, is that on purpose? I'm not sure how to handle it now that we've hit string freeze because the only solutions I see will add strings: either prompts for the username/email if we let them enter it on the form or a warning message.

Thoughts?

keith.smith’s picture

I no longer get this error when I'm logged in. However, as an anonymous user accessing the /contact page (after having given a permission to anonymous to be able to do that), I get:

notice: Undefined index: copy in /web/test/modules/contact/contact.pages.inc on line 133.
greggles’s picture

Status: Active » Needs review
StatusFileSize
new1022 bytes

So, I previously thought that anonymous users should be able to use the user/UID/contact forms but apparently that is not the case (I looked at Drupal5 to be sure). So, this patch fixes the error without trying to make the user/UID/contact form accessible to all.

Basically, ignore my comment #2 and just review/apply this patch :)

dropcube’s picture

Title: Notice on /contact page and contact form only works for logged in users » Inconsistence in in the use of users' contact forms for Anonymous users
Assigned: Unassigned » dropcube
Status: Needs review » Needs work

After applying the patch at #3, Anonymous (non logged) users can not use the user's contact form and a confusing message is showed up:

You need to provide a valid e-mail address to contact other users. Please update your user information and try again.

Anonymous users do not have "user information" (in fact, the link goes to an access denied page) .

We have to chose:

  1. Anonymous users may use registered users contact form (depending on the specific user setting)
  2. Anonymous can not use registered users contact form
  3. Add a new permission "access registered users contact form" and check along with the specific user setting (User account - Contact settings - Personal contact form) if the current user (anonymous or not) has permissions to use registered users contact form
  4. Form me 3 seems more flexible and reasonable.

    I am working on a patch to implement 3

greggles’s picture

For drupal 6 changing functionality and adding strings to the interface is probably not going to happen so I think that #3 is out.

Anonymous users have never been able to use personal contact forms (at least not in 5.x) so I think we should implement #2 by fixing that message about providing a valid e-mail address to instead do a "drupal_access_denied()".

dropcube’s picture

Title: Inconsistence in in the use of users' contact forms for Anonymous users » Personal contact forms can not be used by Anonymous users - no permissions for allow/restrict this
Status: Needs work » Needs review
StatusFileSize
new5.33 KB

Adding a permission 'contact users if they allow' the site administrators will be able to allow/restrict the access to users' personal contact forms. This way, if allowed, Anonymous users will be able to contact users throughout their personal contact page.

- In the patch, the original errors reported in this issue have been fixed.

- The access callback for this page now checks if the current user have permission to contact users and if the user to be contacted has his/her personal contact form enabled.

- The message You cannot contact more than %number users per hour. Please try again later. IMHO is not correct. There is no difference in using the site-wide contact form and users personal contact forms (variable contact_hourly_threshold) . So, a user trying to use a personal contact page for first time may get a message like this even when s/he has not contacted any user. So, the message should be the same of the site-wide contact page: You cannot send more than %number messages per hour. Please try again later.

To reproduce while testing:
- Enable contact.module
- Go to admin/user/permissions and set permissions to anonymous-user/authenticated-user such that the personal contact forms may be used.
- Enable the personal contact form in at least one user
- Try to contact the user anonymously (logged out)
- Try to contact the user logged in

Please test and provide comments or suggestions.

dropcube’s picture

Anonymous users have never been able to use personal contact forms (at least not in 5.x) so I think we should implement #2 by fixing that message about providing a valid e-mail address to instead do a "drupal_access_denied()".

I posted the patch at #6 without reading this. Anyway, the patch is there.

Well, if Anonymous users will not be able to use personal contact forms, in my opinion the best if denied the access completely and do not allow them to access the page.

The patch attached modifies the access callback function to achieve this.

ximo’s picture

Status: Needs review » Reviewed & tested by the community

I came across this bug as well, good to see that it has already been looked into.

I support #2 as well, and the lates patch does just that. It works fine, and is RTBC as far as I can see.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed #7, that one looks logical.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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