A simple and useful addition to the contact module would be a nice theme for a link direct to the contact page. The attached patch provides an option for either a text link or a nice icon link, and it tests whether access should be allowed and displays nothing if there is no access.
Once there is a theme for the contact page link it can be used in several ways:
1) As an optional link on nodes to make it easy to contact the author.
2) As an additional link on the user profile page to make it easier to contact the user.
3) Displayed after the user or author name in custom templates and views.
The current contact process is to click on a link to go to the user page. Look around and try to figure out how to contact the user. If you notice that there's a tab (if you're not used to Drupal you may not), click on the tab that will get you to the contact form. We found in the usability studies that people don't 'see' tabs, so it's pretty easy to miss. On a site where you want to encourage people to contact you or your staff, this is harder than it should be. On a site where you don't want any contact, you can leave things the way they are :-)
In searching whether anyone had already proposed this, I found a lot of threads where people were trying (unsuccessfully) to figure out how to do it, so I think this might be useful.
This is shamelessly ripped from code created by Zack Rosen and joshk in a proposed Views patch #154865: Add field to 'contact' node authors.
Comment | File | Size | Author |
---|---|---|---|
#18 | 370620-contact-theme-link-D7.patch | 1.6 KB | Dave Reid |
Comments
Comment #2
KarenS CreditAttribution: KarenS commentedI don't have any idea why that failed testing, so I don't know what to do with it.
Comment #3
asimmonds CreditAttribution: asimmonds commentedThe patch is not rolled from Drupal's root.
ie contact.module should be modules/contact/contact.module
Comment #4
yched CreditAttribution: yched commentedThe bot is also giving me a hard time on #370480: Field form cleanup and #369562: Field: Trivial cleanup
Issues seem to be focused around test slave 4.
Comment #5
KarenS CreditAttribution: KarenS commentedI'll try again, rolling it from the top this time.
Comment #7
KarenS CreditAttribution: KarenS commentedI give up. Maybe someone else can figure out how to create a patch out of that that will pass testing. It's a very simple patch.
Comment #8
NancyDru"Contact_theme" is not correct for the code.
'arguments' => array('account' => NULL, 'display' => NULL),
should be:
'arguments' => array('account' => NULL, 'text' => NULL, 'display' => NULL),
And, I think the space in
if (! _contact_user_tab_access($account)) {
may not be standard.Comment #9
NancyDruTry this one.
Comment #11
NancyDruIt sure would be nice if "Detailed results" actually told us something.
Comment #12
KarenS CreditAttribution: KarenS commentedYeah, I don't know what invalid PHP syntax it could mean. However as I look at this more I think we can simplify it (and maybe that will make the bot happy).
I wonder if we really need the second test, _contact_user_tab_access() will probably catch all the reasons why the link should not be displayed. So if we remove that test, the patch becomes really really simple and maybe that will work.
You're right about the arguments, I forgot I added another after defining the theme. At least your patch applied, I didn't even get that far. If you want to do that clean up and take another stab, maybe it will work right this time.
Comment #13
NancyDruI believe you are correct, that "if" is not required. But there was no PHP syntax error.
Is there ever a case where the $account object would be "FALSE?" I also have a question about whether
t($text)
is valid.Comment #14
NancyDruComment #16
KarenS CreditAttribution: KarenS commentedI have noticed a bunch of people complaining that patches that should be OK are failing testing. Maybe it's a problem with the bot?
Something like t($text) is not invalid PHP syntax. There's an unsettled debate about whether it's the right way to handle user-provided variables that need translation, but we have code like that in CCK. We can remove that and just hard-code the text, but I doubt that's the problem.
The only other thing I can think of to do is reverse the condition to get rid of the !, like:
Comment #17
NancyDruThat seems more straight-forward to me. I didn't think that "t($text)" was invalid syntax; the "unsettled debate" can be confusing to those of us who can barely handle English let alone more languages.
Comment #18
Dave ReidRevised patch that's a little more flexible and just has a $text parameter that could be passed any image instead of hardcoding ourselves to one. The third parameter is a boolean $html which should be TRUE if $text is already HTML.
Comment #19
Dave ReidThis is an actual API addition, we can't accept this for D7. Would love to get this into Drupal 8 as soon as we can.
Comment #20
NancyDruSince it is an ADDITION, rather than a true change, perhaps it can actually be considered for 7.1 (remember 6.2 that actually broke things)? It won't break anything, just provides admins with a better presentation for end-users and makes Drupal more valuable.
Comment #21
Dave ReidBased that no-one had helped on this from Feb until now is why I based my postponed judgement. If someone wants to help review the patches that would be great and I'd be more confident, but a patch can't be committed and reviewed by just one person.
Comment #22
NancyDruI didn't get D7 until quite some time after Feb. 7 because I hadn't updated to PHP 5.2.5 at that time. Had a usable patch come along and reminded me of this issue, I might have tested it. Now my biggest problem with testing is that I have to clean out the database every time I update to HEAD. That means everything has to be set up all over again, including adding content.
Comment #23
mattyoung CreditAttribution: mattyoung commented.
Comment #24
andypostNow #1588422: Convert contact categories to configuration system landed
Comment #25
andypostIt makes sense to have special field for user to navigate his contact page.
Views exposes contact link for user, so configurable extra-field could be great
Comment #26
Bojhan CreditAttribution: Bojhan as a volunteer commented