Roomify / RfA

Roomify for Accommodations
52 stars 12 forks source link

Wrong user email notification when submit new "listing enquiry form" #398

Open hercab opened 6 years ago

hercab commented 6 years ago

When a new listing enquiry form submit, an first email is sent to the user author of the property with the subject "Your inquiry has been sent!".

Expected Behavior

This mail should arrive to the mail of the guest who is making the request.

Current Behavior

Possible Solution

I think the problem is on line 1660 of the roomify_listing.module file $to_account = user_load($type->uid); if ($existing_account) { $user_wrapper = entity_metadata_wrapper('user', $to_account); $rules_state->currentArguments['user'] = $user_wrapper; $rules_state->variables['user'] = $user_wrapper; pet_action_send_pet('authenticated_user_booking_enquiry', NULL, $to_account, NULL, NULL, array(), $rules_state); }

above the variable $to_account refers to the author and should be $account that refers to the user guest.

Steps to Reproduce from a clean installation of the latest release

1. 2. 3. 4.

Context (Environment)

nicolocaruso85 commented 6 years ago

Thank you for report. Now is fixed.

hercab commented 6 years ago

I think that the creator user of the property would be notificated always on new inquiry, so I suggest the next enhance.

$to_account = user_load($type->uid); // Email author. pet_action_send_pet('new_booking_enquiry', NULL, $to_account, NULL, NULL, array(), $rules_state);

if ($existing_account) { $user_wrapper = entity_metadata_wrapper('user', $account); $rules_state->currentArguments['user'] = $user_wrapper; $rules_state->variables['user'] = $user_wrapper; pet_action_send_pet('authenticated_user_booking_enquiry', NULL, $account, NULL, NULL, array(), $rules_state); } else { // Email user with login instruction. drupal_mail('roomify_conversations', 'register_no_approval_required', $email_address, NULL, array('account' => $account, 'roomify_conversation' => $conversation), variable_get('site_mail', ini_get('sendmail_from'))); }