Skip to content
Snippets Groups Projects
Commit 4536f4c9 authored by falcon's avatar falcon
Browse files

Changed: Autotitle now adds ... to the end of too long titles

parent c0ec8383
No related branches found
No related tags found
No related merge requests found
......@@ -436,8 +436,13 @@ function quiz_question_nodeapi(&$node, $op) {
$q_types = _quiz_question_get_implementations();
foreach ($q_types as $q_type => $info) {
if ($node->type == $q_type) {
if (drupal_strlen($node->title) == 0) {
$node->title = drupal_substr(strip_tags($node->body), 0, variable_get('quiz_autotitle_length', 50));
if (drupal_strlen($node->title) == 0 || !user_access('edit question titles')) {
if (drupal_strlen(strip_tags($node->body)) > variable_get('quiz_autotitle_length', 50)) {
$node->title = drupal_substr(strip_tags($node->body), 0, variable_get('quiz_autotitle_length', 50) - 3) . '...';
}
else {
$node->title = strip_tags($node->body);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment