Loading Personal contact form and access denied Into a user profile page I provide a personal contact to conact the profile woner and that contact form is loaded like this:

$recipient = user_load(array('uid' =&gt; $fptr-&gt;uid));
$output .= drupal_render(drupal_get_form(
    'contact_personal_form', $recipient));


The form shows up nicely and all is well so far. While testing this form after sending 5 test messages I get the warning that I cannot send more than 5 messages within 1 hour. That is OK, but it seems the access to the entire user profile page is denied and it screws up the page layout.

Is there any way I can just lock the personal contact form instead of locking the entire profile page?In other words, is there a way to check if an anonymous user can send a personal message, and based on that check to show or hide just the message form?

Thanks for your help, also I hope that is easy to accomplish:-)
You need to check for flood before rendering the contact form

global $user;
// 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) &amp;&amp; !user_access('administer contact forms')) {
// Don't display forms
}
else {
  $recipient = user_load(array('uid' =&gt; $fptr-&gt;uid));
  $output .= drupal_render(drupal_get_form(
  'contact_personal_form', $recipient));
}