You are here

function feedback_mail_page in Feedback 5

Site-wide feedback page

1 string reference to 'feedback_mail_page'
feedback_menu in ./feedback.module
Implementation of hook_menu().

File

./feedback.module, line 250
Enables a site-wide feedback page.

Code

function feedback_mail_page() {
  if ($pagename = arg(1)) {

    //check if this feedback page exists
    $pages = _feedback_get_page_names();
    if (!in_array($pagename, $pages)) {
      drupal_not_found();
      exit;
    }
  }
  else {
    $pagename = 'default';
  }
  $page = _feedback_get_page($pagename);
  $breadcrumb[] = array(
    'path' => 'feedback',
    'title' => $page->title,
  );
  menu_set_location($breadcrumb);
  drupal_set_title($page->title);
  if (!flood_is_allowed('feedback' . $page->name, $page->hourly_threshold)) {
    $message = t('You cannot send more than !number messages per hour. Please try again later.', array(
      '!number' => $page->hourly_threshold,
    ));
    drupal_set_message($message, 'error');
    return;
  }
  return drupal_get_form('feedback_mail_form', $page);
}