function quiz_stats_validate_vid in Quiz 8.4
Same name and namespace in other branches
- 8.6 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.6 modules/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
File
- modules/
quiz_stats/ quiz_stats.module, line 118 - Quiz stats
Code
function quiz_stats_validate_vid($quiz, $vid) {
if ($quiz
->getType() != 'quiz') {
return FALSE;
}
if (!\Drupal::currentUser()
->hasPermission('access author stats')) {
return FALSE;
}
return $quiz
->id() == 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();
}