Welcome to EdReel.com!Are you like "What were they thinking?" about submission information on webforms? Do you care about the submission date, user, and of all things, ip address of the submitter? I didn't think so. Well, here is a way to get rid of that unnecessary data taking up valuable screen real estate.
Assuming you already have the webform module installed, open /sites/all/modules/webform/webform_report.inc and copy the contents of the following two functions:
theme_webform_results_submissions_header and theme_webform_results_submissions
and paste into template.php replacing theme with your current theme name. Let's say your theme is named 'zen_garden'. The functions in template.php should then be called zen_garden_webform_results_submissions_header and zen_garden_webform_results_submissions respectively.
Comment out the unwanted elements.
/**
* Override theme_webform_results_submissions_header in /sites/all/modules/webform/webform_report.inc
*/
function zen_garden_webform_results_submissions_header($node) {
$columns = array(
array('data' => t('#'), 'field' => 'sid', 'sort' => 'asc'),
//array('data' => t('Submitted'), 'field' => 'submitted'),
);
/*
if (user_access("access webform results")) {
$columns[] = array('data' => t('User'), 'field' => 'name');
$columns[] = array('data' => t('IP Address'), 'field' => 'remote_addr');
}
*/
$columns[] = array('data' => t('Operations'), 'colspan' => 3);
return $columns;
}
/**
* Override theme_webform_results_submissions in /sites/all/modules/webform/webform_report.inc
*/
function zen_garden_webform_results_submissions($node, $submissions) {
global $user;
// This header has to be generated seperately so we can add the SQL necessary
// to sort the results.
$header = theme('webform_results_submissions_header', $node);
$rows = array();
foreach ($submissions as $sid => $submission) {
$row = array(
$sid,
//format_date($submission->submitted, 'small'),
);
/*
if (user_access('access webform results')) {
$row[] = theme('username', $submission);
$row[] = $submission->remote_addr;
}
*/
$row[] = l(t('View'), "node/$node->nid/submission/$sid");
...
Now the three unwanted elements should not appear. Make sure you empty the cache if you don't see results.
Note that this method can also be applied to the theme_webform_results_table_header and theme_webform_results_table functions in /sites/all/modules/webform/webform_report.inc as well. Happy overrides!
Comments
need help
Submitted on November 18th, 2010 by AnonymousI am trying to implement the following changes suggested by you but in my version of webform instead of the function theme_webform_results_submissions
i have
function webform_results_submissions($node, $user_filter, $pager_count) {
global $user;
and when i override this function in template.php i get an error msg...please help
Re: need help
Submitted on December 24th, 2010 by edPlease keep in mind that this post relates to Drupal 5 which will no longer receive security updates and support after Drupal 7 is released early next year. So if you are running Drupal 6 or higher, your configuration will be a bit different. With that said, you cannot override any function that is not prefixed with either theme_ or template_ in template.php. You will need to locate the correct theme function in the webform module folders. Hope that helps.
Question
Submitted on December 1st, 2009 by AnonymousThanks for this. I am looking to create a webform survey that does not store the user information in the results, but I need all the other forms on my site to keep the user info. Is there a way to apply this to only one particular form and not all webforms on the side?
Useful
Submitted on August 25th, 2009 by AnonymousThanks, this works nicely and will save me some time.