How do I show the contact link when I'm logged out?

jared42 - August 23, 2007 - 19:56
Project:Contact Link
Version:5.x-1.0
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:jared42
Status:won't fix
Description

The contact link is there when I'm logged in, but once I log out it disappears. I would like it to be visible in either situation. Any help would be much appreciated. Thanks!

#1

nedjo - August 31, 2007 - 22:13

I believe contact is not available for anonymous users. See these lines in the contactlink.module file:

<?php
 
// Only show link to authenticated users, because user contact
  // is not available to anonymous users.
 
if ($user->uid && in_array($type, array('node', 'comment')) && ($type != 'node' || variable_get('contactlink_'. $object->type, 1)) && $account = user_load(array('uid' => $object->uid))) {
?>

Am I mistaken? Do anonymous users have access to contact forms?

#2

mikey_p - December 20, 2007 - 02:09
Status:active» won't fix

Anonymous users do not have access to users' contact forms. They do have access to the site-wide contact form, but that does not allow contact on a per author basis. Since this module uses Drupal's built in contact form, changing this behavior is outside the scope of the module, so I'm marking this 'won't fix.'

However if you wish to have an option for different default behavior for anonymous users (a link to the sitewide contact form? a message to log in?) please reopen this issue and clarify. Thanks

#3

Onopoc - October 26, 2008 - 19:35

Here are 2 modules that can do something similar. They are for Drupal 5.x. though: http://drupal.org/node/196663#comment-1078230

#4

plasticlax - December 1, 2008 - 21:14
Version:4.7.x-1.x-dev» 5.x-1.0

ok, i think people may end up on this issue looking for ways to create contact forms per node that do not reveal user id. the above two links are related but "author contact" creates a form in a block (haven't tried this even), and Anonymous contact doesn't have any info on implementing their links in the form of contact_anon/nid into the page layout. i edited the contactlink.module file in this module's release and changed line 11 from
if ($user->uid && in_array($type, array('node', 'comment')) && ($type != 'node' || variable_get('contactlink_'. $object->type, 1)) && $account = user_load(array('uid' => $object->uid))) {
to
if (($type != 'node' || variable_get('contactlink_'. $object->type, 1)) && $account = user_load(array('uid' => $object->uid))) {
and line 12
if ($account->contact && ($account->uid != $user->uid)) {
to
if ($account->contact_anon && ($account->uid != $user->uid)) {
and line 15
'href' => "user/$object->uid/contact",
to
'href' => "contact_anon/$object->nid",

this seems to have integrated the two modules (anonymous contact and contact link) to be useful in the way i think others are scouring contributed modules for.

maybe there could be a patch to make this hiding for anonymous users optional and a way to change the url for the contact page in the settings?

 
 

Drupal is a registered trademark of Dries Buytaert.