You are here

function faq_ask_edit in FAQ_Ask 7

Same name and namespace in other branches
  1. 6.2 faq_ask.module \faq_ask_edit()
  2. 6 faq_ask.module \faq_ask_edit()

Get the edit question form.

Checks for the permissions of the current user and redirects to the appropriate edit form.

Parameters

object $node: Node object of the node we are editing

Return value

void

1 string reference to 'faq_ask_edit'
faq_ask_menu in ./faq_ask.module
Implements hook_menu().

File

./faq_ask.module, line 203
This module is an add-on to the FAQ module that allows users with the 'ask question' permission to create a question which will be queued for an 'expert' to answer.

Code

function faq_ask_edit($node) {
  global $user;
  if ($node->status == 1) {
    drupal_set_message(t('That question has already been answered.'), 'status');
  }
  else {
    if (node_access('update', $node)) {
      drupal_goto('node/' . $node->nid . '/edit', array(
        'query' => array(
          'ask' => 'TRUE',
        ),
      ));
    }
    else {
      drupal_set_message(t('You are not allowed to edit that question.'), 'error');
    }
  }
  drupal_goto('node');
}