Commit a40002c7 authored by Dries's avatar Dries

- Patch #453596 by Xano: clean-up of function names.

parent 4ef77a59
......@@ -101,10 +101,10 @@ function contact_menu() {
);
$items['user/%user/contact'] = array(
'title' => 'Contact',
'page callback' => 'contact_user_page',
'page callback' => 'contact_personal_page',
'page arguments' => array(1),
'type' => MENU_LOCAL_TASK,
'access callback' => '_contact_user_tab_access',
'access callback' => '_contact_personal_tab_access',
'access arguments' => array(1),
'weight' => 2,
);
......@@ -112,9 +112,9 @@ function contact_menu() {
}
/**
* Determine if a user can access to the contact tab.
* Determine permission to a user's personal contact form.
*/
function _contact_user_tab_access($account) {
function _contact_personal_tab_access($account) {
global $user;
if (!isset($account->contact)) {
$account->contact = FALSE;
......
......@@ -23,13 +23,16 @@ function contact_site_page() {
}
}
else {
$output = drupal_get_form('contact_mail_page');
$output = drupal_get_form('contact_site_form');
}
return $output;
}
function contact_mail_page() {
/*
* Form builder; the site-wide contact form.
*/
function contact_site_form() {
global $user;
$categories = db_query("SELECT cid, category FROM {contact} ORDER BY weight, category")->fetchAllKeyed();
......@@ -96,9 +99,9 @@ function contact_mail_page() {
}
/**
* Validate the site-wide contact page form submission.
* Form validation handler for contact_site_form().
*/
function contact_mail_page_validate($form, &$form_state) {
function contact_site_form_validate($form, &$form_state) {
if (!$form_state['values']['cid']) {
form_set_error('cid', t('You must select a valid category.'));
}
......@@ -108,9 +111,9 @@ function contact_mail_page_validate($form, &$form_state) {
}
/**
* Process the site-wide contact page form submission.
* Form submission handler for contact_site_form().
*/
function contact_mail_page_submit($form, &$form_state) {
function contact_site_form_submit($form, &$form_state) {
global $language;
$values = $form_state['values'];
......@@ -148,7 +151,7 @@ function contact_mail_page_submit($form, &$form_state) {
/**
* Personal contact page.
*/
function contact_user_page($account) {
function contact_personal_page($account) {
global $user;
if (!valid_email_address($user->mail)) {
......@@ -159,13 +162,16 @@ function contact_user_page($account) {
}
else {
drupal_set_title($account->name);
$output = drupal_get_form('contact_mail_user', $account);
$output = drupal_get_form('contact_personal_form', $account);
}
return $output;
}
function contact_mail_user(&$form_state, $recipient) {
/*
* Form builder; the personal contact form.
*/
function contact_personal_form(&$form_state, $recipient) {
global $user;
$form['#token'] = $user->name . $user->mail;
$form['recipient'] = array('#type' => 'value', '#value' => $recipient);
......@@ -197,9 +203,9 @@ function contact_mail_user(&$form_state, $recipient) {
}
/**
* Process the personal contact page form submission.
* Form submission handler for contact_personal_form().
*/
function contact_mail_user_submit($form, &$form_state) {
function contact_personal_form_submit($form, &$form_state) {
global $user, $language;
$account = $form_state['values']['recipient'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment