I'm wanting to allow users see the results of their input on a survey. I'm having them insert volunteer hours and am getting complaints that they are unable to keep track of the hours.
I need help modifying what I think is the code that would allow users to be able to do this. The code is as follows:
function survey_responses() {
// I cut out a bunch of code here
$header = array(t('Submitted by'), t('Date'), '');
$res = pager_query("SELECT u.uid, u.name, r.created, r.rid FROM {users} u INNER JOIN {survey_responses} r ON r.uid=u.uid WHERE r.nid=%d ORDER BY created DESC", 50, NULL, NULL, $survey->nid);
while ($response = db_fetch_object($res)) {
$rows[] = array(format_name($response), format_date($response->created),
l(t('view'), 'node/'.$survey->nid.'/responses/'.$response->rid));
}
if ($pager = theme('pager', NULL, 50, 0, tablesort_pager())) {
$rows[] = array(array('data' => $pager, 'colspan' => 3));
}
$content = theme('table', $header, $rows);
}
print theme('page', $content);
}
So, basically, I want to hack this code and put it in the user profile page so it shows the total number of volunteer hours when a user views their profile. Or even better, could I use this to create a block or add it to the navigation block so it shows next to or under their user name.
Unfortunately I am more of a dreamer than a coder. Someone please help if you can.