I'm using the core Contact module, with personal contact forms on profile pages. I set both the permissions "Visit user profile" and "Use users' personal contact pages" for anonymous users, but I still just get a 403 when trying to view a user's contact page when logged out.

I am using Pathauto (and Subpathauto) for user profiles; I don't think that's the issue but it's worth mentioning.

Also, this is occurring on Drupal 7.

  • Just rebuild the permission and clear the cache. Commented Jul 2, 2015 at 13:18
  • I already did; it doesn't fix the problem.
    – nkorth
    Commented Jul 2, 2015 at 13:20

2 Answers 2


Assuming that the anonymous users are not trying to access user/0/contact (which would not be an ordinary case), the reasons why they cannot access the contact for a an authenticated user A are essentially 3:

  • User A didn't enable the contact form
  • The setting for enabling the contact form for user A has not been yet saved
  • The anonymous user sent too much messages

In the first two cases, it's the access callback for the user's contact form that block the access, using the following code. (See the comment before the code.)

// 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;

In the third case, it's the form builder that returns an access denied page.

// Check if flood control has been activated for sending e-mails.
  $limit = variable_get('contact_threshold_limit', 5);
  $window = variable_get('contact_threshold_window', 3600);
  if (!flood_is_allowed('contact', $limit, $window) && !user_access('administer contact forms') && !user_access('administer users')) {
    drupal_set_message(t("You cannot send more than %limit messages in @interval. Try again later.", array('%limit' => $limit, '@interval' => format_interval($window))), 'error');

Notice that in last case, the default limit is 5 messages in a hour, and that limit is cumulatively valid for any user sharing the same IP, as flood_is_allowed('contact', $limit, $window) executes the following code.

if (!isset($identifier)) {
  $identifier = ip_address();

If you are not seeing any error message from Drupal ("You cannot send more than […]") and the enabled theme or any module is not hiding the error messages, I would assume the users didn't enable their contact form, or the setting to enable the contact form was not yet saved.

  • Huh. I assumed the contact form was enabled, as I thought other logged-in users could see it. Turns out it was just disabled (for the particular user I was testing). It's almost frustrating for it to be that simple, as this is actually a 2 year old question! (originally on Stack Overflow)
    – nkorth
    Commented Jul 2, 2015 at 21:29
  • The error shown was just "You are not authorized to access this page" in the normal Drupal theme, with status code 403.
    – nkorth
    Commented Jul 2, 2015 at 21:32
  • 1
    "You are not authorized to access this page." is not printed using drupal_set_message(). If a theme is not showing the messages set with drupal_set_message(), or a module is hiding them, you would still see "You are not authorized to access this page." It was not your case, but to be sure there aren't error messages being hidden, you should look at admin/reports/dblog.
    – apaderno
    Commented Jul 2, 2015 at 22:12
  • The not yet saved thing was key for me. The users came in via a migration, and for whatever reason, for a few users though their accounts showed personal contact form being turned on, it didn't work. Just clicking save on those accounts made it start working.
    – UltraBob
    Commented Nov 29, 2016 at 4:38

Contact Form will not work for existing users, when I say existing users I mean users who are before turning on contact module and adding configurations. Check under admin/config/people/accounts Creating new user, and then try accessing the page.

enter image description here

  • The option Enable the personal contact form by default for new users is already checked. Contact pages work perfectly well for logged-in users - my problem is only with anonymous users being unable to access the personal contact pages.
    – nkorth
    Commented Jul 2, 2015 at 13:44
  • 2
    Wait, I misunderstood you - you meant that existing users won't have working contact pages yet! I created a new user, and its profile's contact form was properly visible. This is still not perfect, as I don't know how to fix the contact forms for existing users, but it solves my problem at this point.
    – nkorth
    Commented Jul 2, 2015 at 13:53

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.