Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
You want anonymous users to be able to use the personal contact forms at user/%user/contact but don't want to hack core.
Proposed resolution
Download, enable and configure the module 'contact_user_anon' at comment #6.
Remaining tasks
Give thanks to Dave Reid for his work.
Get this somewhere for people to easily download it via drush etc.
Original report by Rosamunda
It would be great, so people shouldn´t need to patch core contact.module
Comment | File | Size | Author |
---|---|---|---|
#17 | contact_anon_6.x-1.2b.tar_.gz | 15.63 KB | mecano |
#6 | contact_user_anon.zip | 3.55 KB | Dave Reid |
Comments
Comment #1
ezra-g CreditAttribution: ezra-g commentedI would like to update this to Drupal 6, but other work and community contributions are taking priority for me at the moment.
The update should be very straightforward, and would even make a good task for new/learning Drupal developers.
Until I'm able to address this, I would accept patches for review, or please contact me to discuss modest sponsorship for this small upgrade.
Comment #2
Dave ReidI'll take a stab at this. Shouldn't be too hard since I'm already involved in patching #58224: Allow anonymous users access to a members personal contact form.
Comment #3
ezra-g CreditAttribution: ezra-g commentedThat would be great. Thanks!
Comment #4
Dave ReidGoing to assign myself. Ezra-g would it be ok if I had CVS access so I could work on a DRUPAL-6--1 branch of the module?
Comment #5
ezra-g CreditAttribution: ezra-g commentedGranted. Thanks.
Comment #6
Dave ReidSo I'm done with the D6 port, but I realized that my goal and this module's goal are a little different. I thought for a long while that this module was basically a straight backport of #58224: Allow anonymous users access to a members personal contact form to just allow anonymous users access to a member's contact page. My port basically adds a new permission 'access personal contact form' and works with the core contact module to provide the personal contact form to anonymous users. Is that an acceptable and agreeable direction for this module to head towards or should I release that as a separate module?
For kicks and giggles, here's the D6 module attached.
Comment #7
dbeall CreditAttribution: dbeall commentedHi Dave and thanks for your work.. I do have a question before using the mod. I am not sure do to the wording of this.
Do you have to have access to profile or user pages to make use of it. OR can i use a link in nodes for anonymous users to contact a registered user. I have registered users with business listings that would like their contact form available without their profile being visible to anonymous folks.
thanks, dave
Comment #8
Dave ReidFrom the module in #6, users do not need access to user profiles in order to use the user contact form, but anonymous users will need to be assigned the 'access personal contact form' permission assigned to them. In the contact form, the only information anonymous users will see is the username of the person they are contacting.
Comment #9
dbeall CreditAttribution: dbeall commentedThank you Dave...your mod will be a great addition.. I will have it in there asap.
This has been on my wish list for a month. We really need this !!
*You guys that have the ability to write these mods are invaluable.!
Comment #10
ezra-g CreditAttribution: ezra-g commentedThanks for your work here, Dave.
While the functionality of the module you posted here is different from the functionality of contact_anon, each addresses a variation on the same general need: Using a contact form anonymously. In yours, the user doing the contacting is anonymous, whereas contact_anon allows users to contact the author of a node without revealing the author's identity.
I think that both of these bits of functionality could be rolled into contact_anon, and while I haven't tested the module in #6, the code looks good on first scan. To be a proper contact_anon 6.x release, the original functionality should be maintained along with this new functionality.
Since the update to contact anon is relatively small, I might be able to squeeze it in this weekend. I'll keep you posted.
Comment #11
kmontySubscribing
Comment #12
mecano CreditAttribution: mecano commentedSubscribing
Comment #13
mecano CreditAttribution: mecano commented[removed 09.11.04]
Comment #14
kmontyI'm changing the subject to be more descriptive for the Track page.
Also, I have used and tested David Reid's "port" (really a feature addition) from this thread. No comment on the code just posted. Hopefully, we can add Reid's addition to the module with any release.
Comment #15
2ndmile CreditAttribution: 2ndmile commentedTired using your port mecano but anonyums users still get Access Denied page. And I did remember to enable the permission. The port above worked well.
Comment #16
mecano CreditAttribution: mecano commented[removed 09.11.04]
Comment #17
mecano CreditAttribution: mecano commented[removed 09.10.04]
Can some mod remove the link below please? Looks like I have no right to do so, thanks.
Comment #18
Vacilando CreditAttribution: Vacilando commented#17 module does not work. I enabled the module, set persmissions for anonymous users, but still getting access denied / user login.
Comment #19
Vacilando CreditAttribution: Vacilando commentedDave's #6 module works impeccably! Any plans to release it as a D6 version of this module, or as a new D6 module?
Comment #20
mecano CreditAttribution: mecano commented[removed 09.11.04]
Comment #21
Vacilando CreditAttribution: Vacilando commentedHi, mecano
My priority is being able to allow anonymous users to send form mail to site users without exposing site user e-mail addresses.
I tried your solution first, after reading about its advantages.
But it did not function, as I have duly reported.
Thereafter I tried the less perfect - but turned to be working - Dave's module.
I continue to be willing to test any further improvement of your module - just let me know what info you need from me in order to debug it.
Comment #22
mecano CreditAttribution: mecano commented[removed 09.11.04]
Comment #23
pdcarto CreditAttribution: pdcarto commentedI'm using Dave's version and I am very pleased - it does exactly what I need (allows non-logged-in users to use personal contact forms to email users - needless to say, captcha is highly recommended).
At the risk of further splintering this thread, I'm trying to get Views: 'Link to contact' to display personal contact links. I doesn't show these links when the current user is not logged in.
I can get the behavior I want by modifying the render function in
/sites/all/modules/views/modules/contact/views_handler_field_contact_link.inc
changing line ~40 as follows:
// if ($account !== FALSE && $account->contact && $user->uid > 0) {
if ($account !== FALSE && $account->contact ) {
However I'd really rather not hack views. Can anyone educate me on the correct way to override this function in (Dave's) contact_user_anon module?
Comment #24
Dave Reid@pdcarto: I just figured out how to override the contact link handler. It will definately be a part of the D6 port.
Comment #25
glennr CreditAttribution: glennr commented+1 on the Views integration. That's great news, Dave. Thanks.
Comment #26
dbeall CreditAttribution: dbeall commentedI've been using Dave Reids' from #6 since November 7th 2008, It has been working very well. Improvements are always nice to have, but my users like it so far..
I am just giving this a Thumbs UP..
Comment #27
gpk CreditAttribution: gpk commented@6: IMO Dave Reid's module is something different from the original Anonymous Contact - it allows an anonymous user to access a registered user's personal contact form, whereas the original module provides a form to contact a node's author (I think the word "anonymous" refers to the node's author in this context, in that the author's identity potentially remains unknown to the person trying to contact them).
As it happens I was after the same functionality as Dave and have ended up with a virtually identical module of my own. The main difference is that my version doesn't allow the sender to change their "from" name/email address if they are logged in. This is how core's contact.module handles it at the moment. Granted they could log out if they wanted to spoof it but I like the idea of encouraging site users - at least when logged in - to use a consistent identity which is maintained via their user profile page. The other small difference of note is that the sender's email address (as well as their name) is recorded in the watchdog, as with the main site contact form provided by contact.module.
Something else that such a module could usefully do is define a CCK field formatter that makes a link to a user's contact form, so you can easily get a user reference field to display this link in the node itself, without using Views. [edit: maybe that should actually be in the CCK user reference module?]
@23, 24: I was thinking that Views shouldn't just assume that anonymous users don't have permission to view the contact form (although is hard coded into http://api.drupal.org/api/function/contact_menu/6 it is subject to modification by hook_menu_alter()). The contact link handler could check whether the current user has permission to view the contact form dynamically, perhaps by doing
$router_item = menu_get_item($path);
(see http://api.drupal.org/api/function/menu_execute_active_handler/6) and checking$router_item['access']
. However this does seem a bit messy and is actually not really the "Views way". In some situations it might be better to always show the contact form link, and if a user doesn't have permission to access it then this could be handled by suitable text on the 403 page. But that's not the Views way either. On reflection though I've come to see that the current views_handler_field_contact_link.inc approach actually *is* the Views way from what I can make out. And I suspect Dave is planning something similar at #24, usinguser_access('access personal contact form');
.Comment #28
gpk CreditAttribution: gpk commented@23 again: pls ignore my last rambling paragraph above. In http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/views/modul... the access check seems to be duplicated, incorrectly. It already checks
_contact_user_tab_access($account)
so the lineif ($account !== FALSE && $account->contact && $user->uid > 0) {
is both redundant in theory, but in practice wrong because it doesn't allow for the case where the current user has 'administer users' permission.I've filed a bug report (with patch) to get this line removed: #523222: Access check is done twice on link to a user's contact form, and incorrectly.
Comment #29
gpk CreditAttribution: gpk commentedI've actually opened a CVS account application request http://drupal.org/node/539896 and propose to create a new project "Personal Contact Permission" so that there is a lasting solution along the lines of #6. If anyone (especially Dave Reid) has any thoughts/comments please feel free to chip in!
Comment #30
CarbonPig CreditAttribution: CarbonPig commented#6 Dave - Brilliant! Thank you so much! However - I'm running into one slight problem.
Has anyone got the captcha module working with this.
It was mentioned above, but for some reason captcha won't show up on the user contact form.
Thoughts?
Thanks a bunch,
CarbonPig
Comment #31
gpk CreditAttribution: gpk commented@30: you need to tell CAPTCHA about the existence of the new user contact form, which has a different form_id from the one provided by core. On the CAPTCHA settings page try the option
Alternatively if you know the form_id (you can get it from the HTML source) then you can go straight to the "CAPTCHA point form" (the link is on the CAPTCHA settings page, just below the text I've copied above).
Comment #32
ianchan CreditAttribution: ianchan commentedsubscribe
Comment #33
Rob T CreditAttribution: Rob T commentedI've tried both solutions on my 6.13 install. Neither worked.
The module in #6 used to work (which makes me dread upgrading one of my sites from 6.8), but now when activated, mail user call back errors pop up on personal contact form for authenticated users.
The module in #17 never kept returning a message stating that the user has not made contact form available to anonymous users, even after I set the user's persission to accept contact from anonymous users.
0-2 here. Hopefully something else will come about, because I realy don't like the Author Contact module using blocks and making the form visible on node page.
Comment #34
Rob T CreditAttribution: Rob T commentedOne thing I always appreciate is when module creators add an uninstall feature. I realize these aren't complete, but it would be nice.
Comment #35
-Anti- CreditAttribution: -Anti- commentedCame here from: http://drupal.org/node/58224#comment-2138596
Subscribing: Dave, is this thread where you're going to post updates about the D6 back port?
Thanks for your (and everyone else's) work on this.
Comment #36
gpk CreditAttribution: gpk commentedAnyone waiting for a release/backport, the module at http://drupal.org/node/539896#comment-2022182 is 90% or more identical to #6 here and is what I have running on a 6.x site. (Actually I don't recall if that version or #1 in the other issue is what I currently have running but both should work.) It uses a differently named permission from #6 in this issue, apart from that *should* be fully exchangeable, doesn't make any other changes to the site, you should be able to swap back at a later date if nec. and would only need to check the relevant permission. The only noticeable difference in functionality I can think of between #6 here and my version is that mine takes you back to the "previous page" after you send the message, rather than throwing you out to the home page (if you don't have permission to view user profiles).
Comment #37
-Anti- CreditAttribution: -Anti- commentedThanks.
Could someone clarify something though... I was using the contact_x module, but that thread got marked a duplicate of the new D7 contact-form functionality. However, all I've seen so far is people talking about anon users contacting node authors.
I don't care about the 'anonymous user functionality' so much. I need contact-form permissions per role. In other words, I want auth and anon users to be able to access the site-wide form, *without* being able to access the personal contact forms.
Can anyone clarify if this is catered for in the D7 contact-form and in this intended backport?
Comment #38
gpk CreditAttribution: gpk commentedHi Anti,
Not sure what you mean by the contact_x module. But anyway, the original contact_anon module (as it still is for D5) allows users with the relevant permission (I think) to contact node authors, without necessarily knowing who they are (hence "anonymous"). Dave misunderstood what contact_anon was about and at #6 attached a backport of #58224: Allow anonymous users access to a members personal contact form (that issue eventually became #601250: Allow anonymous users to use personal contact forms). However his intention is to combine both bits of functionality into contact_anon. Although those issues are titled in terms of anonymous users what they actually do is add the permission you are talking about. As does the module for 6.x I referenced at #36 above, the module being called "Personal contact permission".
So the answer to your question is "yes"!
HTH..
Comment #39
Dave ReidThis is what core's contact.module currently does. It has a permission just for the site-wide contact form, not for the personal contact forms. So I don't think you need this module.
Comment #40
-Anti- CreditAttribution: -Anti- commentedThis is the D6.9 thread regarding a patch for comment.module
http://drupal.org/node/138574#comment-928203
It clearly states that comment form does not allow a sitewide form without also allowing the personal forms. This has been my experience well past D6.9, although I stopped bothering to check around D6.12. So if a contact form permission made it into core, I believe it has been done very recently.
Anyway, in posts #3 and #6 of the thread, you can see the patch became an unofficial module called contact_x
In post #14, you can see Karen marked it as duplicate.
So the patch or contact_x never got carried forward into D6.x core (at least, not this patch, from this thread).
Karen's stated duplicates eventually all link to the D7 thread:
http://drupal.org/node/138574#comment-928203
However, all of the threads only talk about allowing anonymous to use the contact form. I couldn't see anyone actually discuss adding a proper role based permission to the personal contact forms, like the contact_x module does. Hence my fear that the contact_x module was labelled as a duplicate, but then its functionality was not then actually utilised in the final D7 solution.
> Although those issues are titled in terms of anonymous users what they actually do
> is add the permission you are talking about
OK, thanks for the confirmation.
Although, apparently it might already be in D6.14! I'll have to check one of my websites.
Thanks.
Comment #41
gpk CreditAttribution: gpk commented@39: "core's contact.module ... has a permission just for the site-wide contact form, not for the personal contact forms"
In 6.x, contact.module indeed has no permission for personal contact forms, but automatically gives the ability to access personal contact forms to all authenticated users. Of course you can only access a user's form if it is enabled in their account settings.
@40: tx for the explanation of contact_x. The personal contact form permission *has* made it into core for 7.x, but never will for 6.x since it is is feature-frozen. Hence if you need this permission in 6.x you need to use #6 in this issue (or the one I linked at #36, or contact_x .. each is slightly different and one may be more to your taste).
Comment #42
-Anti- CreditAttribution: -Anti- commentedThanks. I look forward to the back port being worked on. It sounds really good.
In the meantime I'll keep using contact_x - it works well, it's just that it is 'unofficial'.
Comment #43
babbage CreditAttribution: babbage commentedHow about actually making an official 6.x-1.x-dev release on the module listing page? No problem for me to grab it from the "All Versions" section but some people might not realise there even is one...
Comment #44
-Anti- CreditAttribution: -Anti- commentedMy dislike of using contact_x doesn't stem from the fact that it isn't listed per se. The problems I perceive are that it doesn't have a maintainer, and there are no notifications made if it is somehow updated, there are no bug-reports, and there is no-one testing security. It's these things make me slightly nervous of using any 'unofficial modules' that are posted into forum threads or blogs.
However, if you want to get it listed just purely from the point of being easier to find, a few people might find that helpful, at least until the 'anonymous contact' module has had the D7 features included.
Comment #45
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commentedIs #17 worth for production site ?
Comment #46
mecano CreditAttribution: mecano commentedI personally do (and I'll be thankfull if some admin could remove the patch I attached at #17).
Comment #47
ezra-g CreditAttribution: ezra-g commented@mecano - Why do you want the file removed?
Comment #48
babbage CreditAttribution: babbage commented@-Anti- I'm not really quite sure what you're talking about. I'm not referring to any unofficial module; I'm referring to the development version of this module for Drupal 6.x that has been committed to CVS but for which a -dev release has not been listed on the module listing page...
Comment #49
-Anti- CreditAttribution: -Anti- commented> @-Anti- I'm not really quite sure what you're talking about. I'm not referring to any unofficial module
Read #42 (which was the last in a thread from #38 to #42), and then #43.
You can understand why I thought you were offering to make the contact_x module 'official'.
I realise now that you were talking about releasing a dev version of 'Anonymous Contact'.
Sorry for the confusion.
Comment #50
minus CreditAttribution: minus commentedThank you. #6
Comment #51
mecano CreditAttribution: mecano commented@ezra I guess it is useless here and have only bad reports (sic, reports is not really the right word, let's say instant feedback, I would have like to have constructive comments on it but… blah…) + I got tired of acrimony, I did not post it to play a stupid competition but to fill a void, give back and help. reading back the comments and my responses some months later I wondered how naive I was to politely answer… why I erase my posts lately, so please remove that file (more so if I'm the only one reporting it working -mwahahahahaha- what's the point of keeping it?), peace ^^
Comment #52
Rosamunda CreditAttribution: Rosamunda commented+1 to this!
Comment #53
Ken Hawkins CreditAttribution: Ken Hawkins commentedFor those still dealing with there seems to be a solution in a backport of d7's contact form. See: http://drupal.org/project/contact/
Comment #54
GoldNuts. I wish I'd spotted this earlier. I could have helped out.
I've just contributed this;
http://drupal.org/project/anonymous_contact
Feel free to pillage it for code if it's useful.
Comment #55
scottsawyerAbout to try Anonymous_contact. I'll report back.
BTW, everyone who has worked on this ROCKS! I am always amazed that when I need something, someone is working on it, thanks.
I'd also like to see the features mentioned:
* Restrict those that can be contacted to a role or roles
* Allow Users to control if they can be contacted through this
Comment #56
gpk CreditAttribution: gpk commented@55: http://drupal.org/project/contact may have more of the features you are looking for.
Comment #57
nikkhia CreditAttribution: nikkhia commentedI've instaled #6 but I'm not able to make it work. Do I have to add any user permission ?
Comment #58
gpk CreditAttribution: gpk commentedTry http://drupal.org/project/contact/. Or even http://drupal.org/project/anonymous_contact.
Comment #59
nikkhia CreditAttribution: nikkhia commentedThansk for the fast reply, I've also tried anonymous contact, but even after enabling permission I get the access denied message on personal contact forms.
I'm checking the other link right now to see what happens.
Comment #59.0
larowlanUpdated summary so people know what's happening here