Skip to content

Instantly share code, notes, and snippets.

@BevanR
Created June 11, 2014 21:47
Show Gist options
  • Save BevanR/a445cbfa3a6dd7054a16 to your computer and use it in GitHub Desktop.
Save BevanR/a445cbfa3a6dd7054a16 to your computer and use it in GitHub Desktop.
--- archetype_quiz.module
+++ (clipboard)
@@ -1,11 +1,11 @@
- // Get the subject UIDs of quiz results:
- $sql = 'SELECT DISTINCT quiz.uid FROM {archetype_quiz_results} quiz
+ // Get the author UIDs of quiz results:
+ $sql = 'SELECT DISTINCT quiz.author FROM {archetype_quiz_results} quiz
-- by users who have not deleted their accounts.
- INNER JOIN {users} u ON quiz.uid = u.uid
- -- by the given user.
- WHERE quiz.author = :uid
+ INNER JOIN {users} u ON quiz.author = u.uid
+ -- about the given user.
+ WHERE quiz.uid = :uid
-- by people other than the author.
AND quiz.author != quiz.uid
-- by users who have not been banned or otherwise deactivated.
AND u.status = 1';
- return db_query($sql, array(':uid' => $author))->fetchCol();
+ return db_query($sql, array(':uid' => $subject))->fetchCol();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment