Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
10.08 KB

Here is an initial not tested port, but i will test it next week.

In general the codestyle of this module is really bad, but i still just tryed to port it, not to change it's codestyle.

Remove 100% silly tags

Stomper’s picture

Good to know there will be work on a D7 version. Will it continue as a direct port or a re-design of the code etc.?

bryancasler’s picture

subscribe

dawehner’s picture

Title: Hi, there is no Verion for Drupal 7? » Port author contact to drupal7

Change title.

A personal statement:
Everyone who subscribes to a port issue but don't test the already existing code, should think about the action first.

bryancasler’s picture

How do you know I'm not?

HamsterTrainer’s picture

The Patch dont work.

parvardeh’s picture

Any update on the drupal 7 port? THis is a great module and I need it for my new website.

Stomper’s picture

Any alternatives to this module that are D7 supported?

dawehner’s picture

@animelion
You test a patch without writing any kind of feedback? I really really doubt this, sry.

yraber’s picture

The best alternative that I found is to use the module privatemsg. In the settings you can easily add a link to contact the author of a node.
It can also do much more (integrates with Rules).

Stomper’s picture

Thanks for the recc. I'm already running privatemsg so it's nice to see I don't need to install and additional module. Will give it a go and report back.

parvardeh’s picture

I successfully patched the module without any problem, thanks for this patch.
Though after installing it when I go to blocks and click on the configure I get this error:
Fatal error: Call to undefined function node_get_types() in C:\xampp\htdocs\xxxxxxx\sites\all\modules\authorcontact\authorcontact.module on line 50

any comment or suggestions???

globalplayer’s picture

I have the same error
Fatal error: Call to undefined function node_get_types() in C:\xampp\htdocs\xxxxxxx\sites\all\modules\authorcontact\authorcontact.module on line 50

mefisto75’s picture

@yraber It should be mentioned that privatemsg doesn't support anonymous posting.
A blocker for some usecases

podarok’s picture

Issue tags: +D7 porting
hellomobe’s picture

FileSize
7.72 KB

I have this working with some minor changes to the patch - I added a few items so edit/take out as you want. Needs review on block content - description. Sorry I don't know how to patch. This is a copy of the .module file.

Jarviss’s picture

FileSize
11.74 KB

Test on Drupal 7.12 Failed (post #16) I took last drupal 6 version replaced .module file code with (post #16 code)
there was a small bug on line 96 text line without print ' '; after fixing it,
the contact form block is not shown on node page after making settings in block contact form.

hedel’s picture

Test #17 on Drupal 7.14 Working!
In the block configuration I select the content type where I want show the authorcontact block and is ok.

Thanks to everybody!

Hitby’s picture

Works fine here on 7.14

whmedia’s picture

thanks it works great with 7.15

Checky’s picture

I can install this into my Drupal 7, but it doesn't display in the nodes.
I'm using display suite, but even in pages where this isn't enabled it doesn't show.

Anybody that can help get this to work in Drupal 7?
This is exactly the module I'm searching for!

johnhorning’s picture

Attachment on comment 17 seems to be working with Drupal 7.17 except for this error message upon submitting the form:
Notice: Undefined index: sendername in authorcontact_form_submit() (line 193 of /home/rivulcom/drupal-7.17/sites/all/modules/authorcontact/authorcontact.module).

tyler-durden’s picture

I can confirm I am getting a similar error with Drupal 7.18 on the node itself.

Notice: Undefined index: contact in authorcontact_block_view() (line 87 of /home/sites/all/modules/authorcontactI /authorcontact.module).

I can't help since I'm not a coder, but this was an essential module I used in D6, and I need it in my port to D7. Any help would be very grateful !!

tyler-durden’s picture

Here is the code from that area, the block doesn't display on the node but the error message above is there instead.

if ($node = menu_get_object() && arg(2) == '') {
			//check if author has allowed contact in profile settings
			$node = menu_get_object();
			$author = user_load($node->uid);
			// @todo is this still needed
			$contact  = $author->data['contact'];
			if (empty($contact)) {
			  // User has not allowed contact in profile settings
			return;
			}

Line 87 is

$contact  = $author->data['contact'];
tyler-durden’s picture

In case anyone else runs into this:
Make sure you have the Drupal Contact module installed AND the "Personal contact form" option is selected under the author's account settings. This resolved my errors above.

tyler-durden’s picture

After submitting the form, I do howver get the same error as johnhorning in #22 so not all is well.

Also the only fields shown in the block are "email" and "Message", no "Sender Name" which is likely where the error is coming from. I am using the file from #17.

Thanks in advance for any help, I'm surprised this is not required by more Drupal'ers

Drave Robber’s picture

On top of that, access check is done wrong - the block shows up on own nodes.

I'm looking into this but dawehner in #1 is right - coding style is quite bad. So it may take more than two hours to sort out.

Drave Robber’s picture

Code's in my sandbox: D7 port of Author Contact
(will post as a patch, too)

I believe most annoying errors/warnings have been fixed (time spent so far: 1 hour 16 minutes, including one cup of coffee and one cigarette); proper cleanup of this could probably take weeks.

Drave Robber’s picture

A lump patch and a .zip archive for people who prefer those formats.

Drave Robber’s picture

Some thoughts:

FILE: /var/www/drupal-7-pareview/pareview_temp/authorcontact.module
--------------------------------------------------------------------------------
FOUND 271 ERROR(S) AND 16 WARNING(S) AFFECTING 143 LINE(S)
JmsCrk’s picture

Hi guys, just checking in here. First off let me apologise for the coding style - this was my first Drupal module and I've learnt a lot since.

As I've stated before my opinion is that it would be better to re-create this module as an add-on for WebForm, rather than port it to Drupal 7 the way it is.

Unfortunately, I don't have the time to do this, or to maintain it properly even working the way it does now.

@Drave Robber, would you like me to share maintainership of this module with you? Then you can push your patches directly. (Or anyone else...)

Drave Robber’s picture

@JmsCrk: thanks for the offer, I'll consider it when I have some feedback re: functionality (it's worth polishing if I can get it working :).

On a more general note, I believe there is enough demand for a simple solution without additional dependencies; Webform is cool and introduces new possibilities, but among those are possibilities of modules conflicting and breaking each other's stuff.

As for coding standards, I've seen worse - here we have mostly indenting issues; also, I started off #17, so at least part of the issues were probably introduced earlier in this thread.

tyler-durden’s picture

Awesome, thanks for the help Drave. the next few days I'm devoted to my main job, as this development is s side project. i will give it a go in the next day or 2, I'm sure it works. But quickly...

1) I like the idea of how this module is, it's not bloated for what it does. Allow to contact a node author without sharing their email address. I'm really surprised this feauture isn't needed more as you currently cannot do it in D7 without creating your own module. You can almost get there with the current Webforms 7.4 beta. I should know, I spent nearly a week testing different options and using google a lot.

2) It would be nice for it to work in Webforms also, as I'd like to have the initial contact recorded somehow on the db end, but it is not required. But then again Webforms is a lot of bulk for what this simple module really is.

I'll get back here after I have some time to play with this.

Drave Robber’s picture

Unsure about this:

    '#default_value' => t('Please contact me regarding this post.'), // added

(I don't know who added it)

This makes it possible to send an e-mail by clicking accidentally (such things happen). Also, "think about users, not for users".

Removed for now.

Drave Robber’s picture

An updated version with more cleanup pushed to the sandbox.

PAReview down to 142 errors / 3 warnings (almost in half).

I restored 'Contact description' functionality; you can still leave it blank if you don't need it. (The reason why people could not get it to work is that in D7, drupal_get_form() returns a render array instead of HTML as in D6; hence, you cannot concatenate it with .=)

Drave Robber’s picture

A note on access handling:

I made use of _contact_personal_tab_access(), so the block behaves the same way as 'Contact' tab on user profiles. (That is, it respects permission settings as to whether anonymous users may use it etc.)

As a side effect, the block is still shown on own nodes for users who have 'administer users' permission.

If anyone has an opinion on this, speak out now or... you will need to submit a feature request later. :)

Drave Robber’s picture

FileSize
7.32 KB

screenshot

This looks too much like 'mission accomplished' in most themes, as if I had done something good. I suggest changing this to warning (yellow).

Drave Robber’s picture

FileSize
7.21 KB

Like this:
screenshot

Drave Robber’s picture

FileSize
4.92 KB

PAReview is clean now. (And it didn't even take "weeks".)

You can view commit history if you wish. (Hint: check 'commitdiff' to see each individual change)

Functionality added: an option to allow authenticated users use different name/email (i.e., present them with prepopulated textfields instead of fixed entries).

Attached: .zip for those who prefer .zip.

@JmsCrk: there still is some space for improvements but IMHO generally this seems good enough for 7.x-1.0-alpha1; is your co-maintainership offer still good?

tyler-durden’s picture

Thanks for all the help Drave Robber. I would love to at least see this released as 7.x-1.0-alpha1, since I found many other threads in different forums looking for this and most were told a new module would need to be written. I have been testing it this morning with only 2 minor issues.

1) The BCC address function doesn't seem to be working, and

2) The email received by the node author is labeled as "nobody@yourdomain.com" so a user just can't hit reply to the email for it to go back to the original sender.

Both of these issues you brought to my attention so they are not new. THANKS AGAIN!

Drave Robber’s picture

FileSize
5.01 KB

Updated in the sandbox, new .zip attached.

Bcc is now sent separately, with slightly different subject line and body to avoid potential confusion.

Drave Robber’s picture

FileSize
5.01 KB

Fixed inconsistency in using $sender->mail / $sender->email that made it act up slightly for anonymous users.

Sandbox code updated, too.

saiya’s picture

Hi there, thanks for the D7 module.
i have 1 problem by using this module in a quicktab.

i have put the Author Contact block in the quicktab. and the quicktab i put on the region content bottom.

so when the anonymous user view on the node, it will show them the content and the tab,
1st tab is some of the content of the page, and
2nd tab is the author contact block. and
3rd tab is a Site-wide contact form block.

when i am user #1 or admin, i can see the 2nd tab and 3rd tab. but when im anonymous, i only can see the 3rd tab.

is there i have missing some settings.

i have read the readme.txt file and i already done this
3. Click on CONFIGURE link beside the block 'Author Contact'.

and this i not understand

5. Please note that this module now takes notice of each user's setting for
'personal contact form' in their profile. If a user has not allowed personal
contact, the Author Contact form will not appear on their nodes.

in the permission settings.
i already tick on anonymous on
"Use the site-wide contact form" and "Use users personal contact forms "

jasom’s picture

Hi, I discovered new form module entitiforms. I have asked question, if it can do same functionality as author contact. You can support it here #1966870: Is possible to use entityforms to contact node author?

jasom’s picture

Module seems working. I received mail as normal and also bbc copy was delivered.

Due to spam it's better when emails are generated from site default address (or address set in block configuration, something like norepaly@example.com) with "reply-to" part set to be email address defined by submitter. Now it's sender address set to be address defined by submitter and that isn't good.

Add to message body this: If you do not with to receive these notification, please update your user account preferences @site/uid/edit

saiya’s picture

hi,
anonymous user cannot view the author contact block. if im login as admin, i can see the author contact block. how to get anonymous to view the author contact block?

jasom’s picture

- try set up permissions for module contact
- try set up visibility for block

but this is probably it:

- most common mistake is that user need to allow "use contact me" on his user setting page. Admin see author contact block whatever settings are. If you enabled contact module after users account were created, users need additionally check "contact me" checkbox. For every new user it is checked by default.

BTW, where is stored this value - if user can be contacted or no? I couldn't find it in DB, to proceed bulk update by MySQL query.

Drave Robber’s picture

@jasom:
#47 - users table, data column, but it's serialized together with other user-specific settings, e.g. a:2:{s:7:"contact";i:1;s:7:"overlay";i:1;} (here, contact is enabled); so it won't be easy to update en masse.
#45 - both good points, I'm going to implement these when I have some spare time.

saiya’s picture

but this is probably it:

- most common mistake is that user need to allow "use contact me" on his user setting page. Admin see author contact block whatever settings are. If you enabled contact module after users account were created, users need additionally check "contact me" checkbox. For every new user it is checked by default.

@jasom

Yes thanks for point it out! i dint realize i have to check in the user setting page. its working now. thanks.

Gemini Lights’s picture

Thank you so much for the D7 module.

chrisck’s picture

Is it possible to send a copy of the email to the sender?

jasom’s picture

You can use same feature using webform.

pyshgavak’s picture

This module is great and work perfectly.

But is there a easy way to include captcha option? I can do it in contact form but not in this block...

Also, should this V7 module should be added to the project page? After all, it works very well! :)

tyler-durden’s picture

I agree completely that the D7 module should be included on the project page, as I am even using it on live sites now.

As for the Captcha, I believe in the Captcha Admin settings you can select "Add CAPTCHA administration links to forms", and when you visit a page with the Author Contact form, you will be able to activate Captcha for this field (it will enable Captcha on all Author Contact forms, not just the one you are on).

This is how I got it to work on D6, I am not using Captcha on my D7 sites so I can't confirm the D7 Captcha module works exactly the same. Hope this helps you.

alexhaack’s picture

Issue summary: View changes
FileSize
1.82 KB

Here comes from last file (post 42, file authorcontact_3.zip) a translation in German. The translation is not very perfect, but quite useful. For any suggestions or similar, write something here.

### Deutsch ###
Hier kommt von der letzten Datei (Beitrag 42, Datei authorcontact_3.zip) eine Übersetzung auf deutsch. Die Übersetzung ist nicht sehr perfekt, aber gut brauchbar. Für Vorschläge oder ähnliches, schreibt hier etwas.

alexhaack’s picture

A small update for #55.

jasom’s picture

You can have the same functionality with superior Webform module. Here is tutorial how to achieve send email to current node author. It's exactly what Author Contact does.