function security_questions_add_question in Security Questions 7.2
Same name and namespace in other branches
- 6.2 security_questions.module \security_questions_add_question()
Utility function to add a question.
Parameters
$text: The question text.
$uid: (optional) If this is a per-user question, the ID of the user. Defaults to 0 to indicate a system-wide question.
$machine_name: (optional) A machine-readable name, to make the question exportable.
Return value
The ID of the newly created question, or FALSE if failed to save.
3 calls to security_questions_add_question()
- security_questions_install in ./
security_questions.install - Implements hook_install().
- security_questions_list_form_submit in ./
security_questions.admin.inc - Questions add form submit handler.
- security_questions_user_answers_save in ./
security_questions.module - Saves a full set of answers and custom questions for a user.
File
- ./
security_questions.module, line 672 - Main module file for security_questions.
Code
function security_questions_add_question($text, $uid = 0, $machine_name = NULL) {
$question = new stdClass();
$question->question = $text;
$question->uid = $uid;
$question->machine_name = $machine_name;
if (security_questions_question_save($question)) {
return $question->sqid;
}
return FALSE;
}