0

I think this is pretty simple, but I don't know what's the best way to achieve this.

This is what I need:

  • Add a button on each user profile page. When another user clicks on the button, it opens a form (in a popup window would be great) to write the message. The email should be sent to the user of the profile page we are seeing.

If it's not possible to add a form, I just need a "mailto:useremail" so when i click the button opens the outlook our gmail, wtv.

How can I do this? Is there a simple way?

Thank you!

2
  • 1
    Hi, both solutions are great, I managed to solve this. Thanks
    – Drii7
    Commented Nov 15, 2016 at 22:58
  • Remember to mark the answer that solved your problem please :)
    – DarkteK
    Commented Nov 21, 2016 at 20:17

2 Answers 2

2

To get what you want, you need to modify the template user, to do this you need to follow the next steps:

  1. Find the file called user-profile.tpl it is in the module user modules\user (NOT inside sites/all/modules).

  2. Once you found it, open it, and you should see at the end of the file something like this:

print render($user_profile);

  1. Now copy and paste this line of code inside php tags:

$usr = user_load(arg(1));

echo 'mail.'?Subject=textyouwant" target="_blank">Send Mail';

That should work !

2

@Drii7, Drupal provides with a default contact us form, but if you insist to use the mailto:username, you can overwrite the template in the user module as suggested by @DarkteK. You can copy the file in your theme's templates folder and add a mailto link where you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.