function quiz_stats_validate_vid in Quiz 7.6
Same name and namespace in other branches
- 8.6 modules/quiz_stats/quiz_stats.module \quiz_stats_validate_vid()
- 8.4 modules/quiz_stats/quiz_stats.module \quiz_stats_validate_vid()
- 8.5 modules/quiz_stats/quiz_stats.module \quiz_stats_validate_vid()
- 6.4 includes/quiz_stats/quiz_stats.module \quiz_stats_validate_vid()
- 7 includes/quiz_stats/quiz_stats.module \quiz_stats_validate_vid()
- 7.4 includes/quiz_stats/quiz_stats.module \quiz_stats_validate_vid()
- 7.5 modules/quiz_stats/quiz_stats.module \quiz_stats_validate_vid()
- 6.x modules/quiz_stats/quiz_stats.module \quiz_stats_validate_vid()
Validate that a node is of type quiz, and that the user has access to it, and that the vid is a vid of that quiz
Parameters
$quiz: The quiz node
$vid: The version id
Return value
TRUE if user has access
1 string reference to 'quiz_stats_validate_vid'
- quiz_stats_menu in modules/
quiz_stats/ quiz_stats.module - Implements hook_menu().
File
- modules/
quiz_stats/ quiz_stats.module, line 137 - Quiz stats
Code
function quiz_stats_validate_vid($quiz, $vid) {
if ($quiz->type != 'quiz') {
return FALSE;
}
if (!user_access('access author stats')) {
return FALSE;
}
return $quiz->nid == db_query('SELECT n.nid FROM {node} n INNER JOIN {node_revision} nr ON (n.nid = nr.nid) WHERE nr.vid = :vid', array(
':vid' => $vid,
))
->fetchField();
}