I am new to drupal , and need functionality like , When any Users submit Webform then i am displaying that submitted data in another page . but in between i need Admin Approval so for that how to change code in Webform module.

I have used all modules like MODR8 , RULES , VBO , Moderation etc.

if anyone knows plz help me becoz i am trying to solve this problem from last 2 weeks.

Thanks in advance.


You can try something like this for admin approval: 1. create custom content type; 2. create fields just like your webform has; 3. copy copy webform-confirmation.tpl.php and change the name webform-confirmation-NID.tpl.php 4. there write something like this:

include_once(drupal_get_path('module', 'webform') .'/includes/webform.submissions.inc');
$nid = arg(1);
$sid = $_GET['sid'];

$submission = webform_get_submission($nid, $sid);

$otzyv_text = $submission->data[1]['value'][0];
$name = $submission->data[2]['value'][0];
$email = $submission->data[3]['value'][0];
$title = mb_substr($otzyv_text, 0, 10);

$node = new stdClass();
$node->type = 'response';
$node->title = $title;
$node->language = LANGUAGE_NONE;
$node->body[$node->language][0]['value'] = $otzyv_text;
$node->body[$node->language][0]['summary'] = '';
$node->body[$node->language][0]['format'] = 'filtered_html';
$node->field_name[$node->language][0]['value'] = $name;
$node->field_e_mail[$node->language][0]['value'] = $email;
$node->uid = 1;
$node->status = 0;
$node->promote = 0;


(this is what i've done when my customer wanted to have an ability admin approval). By this way you will have unpublished nodes when someone submits your form (administrator can publish them whenever he wants). After that in IF statement you can write something like:

$node = menu_get_object();
if($node->type == 'YOUR TYPE' && $node->status == 1) {
  // Display submitted data... You can fetch them from node object

or with Views module you can create block or anything you want by that content type...

  • hi, i have tried this , but in my case , I have choose option No redirection in Form setting at admin side under Webform tab. so can you tell me another solution if possible. thanks in advance.
    – megi
    Apr 4 '13 at 4:56
  • You can customize this functionality a little bit, e.g. like this: In this file (webform-confirmation-NID.tpl.php) add header('Location: ' . $_SERVER['HTTP_REFERER'].'?response=yes'); after node_save($node) function. Then create node--NID.tpl.php and remove all unnecessary php code, just leave print render($content); Then open page.tpl.php and before content region add <?php if(isset($_GET['response'])) {print '<div class="response-yes">Confirmation Text.</div>';} ?>. It's it..
    – xurshid29
    Apr 4 '13 at 5:54
  • You can see demo here ergana.md.uz/content/otzyvy-0 Here feedback are not published automatically. If you add feedback, then before feedbacks block appears confirmation text, but without redirection. Feedback is shown when admin publishes it.
    – xurshid29
    Apr 4 '13 at 5:57

i have solved my problem by creating new table in database and create new custom module at adminside.

i have stored webform submitted data in 1 table and in my custom module at adminside display that data and add 1 field in table like published with checkbox , so when admin tick checkbox and click on submit button , in my table i have updated status to 1.

Thanks, Megi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.