0

I am using a custom user-profile.tpl and I want to add a 'contact user' link to the viewed users personal contact page.

How can I check that the user in question has a contact page enabled? Is there a variable I can look at, or maybe a db query that can be run?

I am not using tabs on the user profile page.

Thanks, Paul.

1

This is taken from contact.module:

function _contact_personal_tab_access($account) {
  global $user;

***snip***

  // If the requested user has disabled their contact form, or this preference
  // has not yet been saved, do not allow users to contact them.
  if (empty($account->data['contact'])) {
    return FALSE;
  }

***snip***

  return user_access('access user contact forms');
}

You should be able to see in the user object whether or not they have they are allowing people to contact them. This will also be empty if they don't have a contact form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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