When will webform block be compatible with version 6.x-3.0 of webform? I need both webform 6.x-3.0 and webform block - both are very useful modules.

Comments

rovo’s picture

Version: 6.x-1.1 » 6.x-1.x-dev

I am having the same trouble. Trying to get the DB tables adjusted so that it will show the generated block, but have not found a way yet.

rovo’s picture

I am having the same trouble. Trying to get the DB tables adjusted so that it will show the generated block, but have not found a way yet.

kevinquillen’s picture

Subscribing

sgabe’s picture

The development snapshot seems to be compatible with Webform 3.0, did you try it?

sutharsan’s picture

I updated from 6.x-1.1 to 6.x-1.x-dev (July 11, 2010). The block was not listed on the admin/build/blocks page although the data in the webformblock table and the blocks table all looked ok. I only got it working by deleting the block record in the blocks table.

dhbanes’s picture

The problem seems to be that although the block is generated and added to the `block` table, by default the "status" is set to "1" but "region" is blank. So, basically, because it is "enabled" by default (Status = 1), it does now show up in the list of disabled blocks, but because there is no region set (Region = ""), it is not listed under any region either. This effectively hides it from the administrator. I think the fix is to have the module set status to 0 instead of 1 by default.

quicksketch’s picture

I've released Webform 3.0 and will be marking it as the recommended version shortly. Since Webform Block doesn't have a release which supports 3.0, I've removed it from the Webform project page. Please let me know when this is complete and I'll re-add Webform Block to the project page of Webform.

mattiasj’s picture

subscribe

achton’s picture

subscribing

sgabe’s picture

I attached a patch for Webform 3.0 in #248157: Allow any Webform to be displayed as a block with this functionality.

ilw’s picture

subscribe

nickorr’s picture

I got this to work in webform 3 by using the dev build and making a small change before uploading the module. On line 228 is the insert code :

db_query('INSERT INTO {blocks} (module, delta, theme, status, weight, region, custom, throttle, visibility, pages, title, cache) VALUES ("webformblock", %d, "%s", 1, 0, "", 0, 0, 1, "", "%s", 1)', $nid, $theme_key, $node->title);

Change it to :

db_query('INSERT INTO {blocks} (module, delta, theme, status, weight, region, custom, throttle, visibility, pages, title, cache) VALUES ("webformblock", %d, "%s", 0, 0, "", 0, 0, 1, "", "%s", 1)', $nid, $theme_key, $node->title);

All you're doing is changing the first 1 to a 0. Enabled the module and followed the instructions and all was good.

Cheers,
Nick

drj8022’s picture

Thank you!!!!!! I wound up manually running the following two statements to get everything working:

INSERT INTO webform_block (nid) VALUES (380);
INSERT INTO blocks (module, delta, theme, status, weight, region, custom, throttle, visibility, pages, title, cache) VALUES ("webformblock", 380, "theme_name", 0, 0, "", 0, 0, 1, "", "Some Nice Title", 1);

mlncn’s picture

Abandoning Webform Block for the patch to webform over at #248157: Allow any Webform to be displayed as a block?

I would roll a patch here for the change Nick describes, but it doesn't seem the maintainer is home? Also i just don't understand why the problem being fixed seems to be how this module works with blocks (which haven't changed), not how it works with webforms (which have)!

mandclu’s picture

I've tried both the change suggested in #12 and the manual entry in #14. My problem is that I can see the entry in the blocks table, but when I go to the Blocks page the webform isn't listed. What's more, if I then refresh the blocks table the entry has been deleted. Any thoughts?

sgabe’s picture

@surge_martin: If you have any problem with the patch suggested in #14 you should report it in #248157: Allow any Webform to be displayed as a block.

aiphes’s picture

i'm waiting for a release webform 3.0compatible to switch WForm 2.0 to 3.0...and can use additionnal modules...hope it will be soon.

mlncn’s picture

Category: support » bug
Status: Active » Postponed

In case the links above don't make it clear, the Webform Block module will be effectively deprecated by the inclusion of the functionality in Webform itself– as is done in the working patch at #248157: Allow any Webform to be displayed as a block.

Marking this bug as postponed; when Webform takes care of it this issue can be closed.

kevancummins’s picture

HI all

I had same problem but donwloaded the latest dev version 6.x-1.x-dev dated July and it works with Webform 6.x-3.2. I can see the block in the blocks list and add to a panel.

Kevan

aiphes’s picture

For me too, webformblock dev july2010 works on my test local website with webform 3.2...so 2 options are available : module or patch...module is the best way i think no ?
submission is well received but redirection page failed with a 404..

kevancummins’s picture

The module maintainer has just updated the dev version - downoad latest and it should work

mghatiya’s picture

It doesn't work for me, even after downloading the latest one.

kavita_k’s picture

Version: 6.x-1.x-dev » 6.x-1.1
Category: bug » support
Priority: Normal » Major
Status: Postponed » Active

Hi,

Even I am facing the same problem. Please help...

cleverhoods’s picture

Status: Active » Needs review

Here is a little solution. This is the quick and dirty method
This is work for me.
Copy this code in to your webform_block.module file save and tadaa ^^

and of course I'm very sorry to not creating a patch, but it too late for me to do such a thing ^^


// $Id: webformblock.module,v 1.1.2.2 2009/06/26 14:18:05 budda Exp $

/**
 * @file
 * Expose webform nodes as Drupal blocks.
 */

/*
 * Add a checkbox on webform node editing page under 'advanced'.
 * Allows the activating of a corresponding block
 *
 */
function webformblock_form_alter(&$form, $form_state, $form_id) {
  $node = $form['#parameters'][2];

  if ($form_id == 'webform_node_form') {
    $form['webform_addblock'] = array(
      '#type' => 'checkbox',
      '#return_value' => 1,
      '#default_value' => webformblock_nodestatus($form['nid']['#value']),
      '#title' => t('Generate a block'),
      '#description' => t('Allow this form to appear in its own block which can be positioned in any block region.'),
      '#weight' => -20,
    );
  } elseif ($node->webform_addblock == 1) { 
    form_clean_id(null, true);
    $anchorname = form_clean_id(str_replace('/', '', strtolower( drupal_get_path_alias('node/' . $node->nid) ))); 
    $form['#action'] = url(drupal_get_path_alias($_GET['q']), array('fragment' => $anchorname)); 
  }
}


/*
 * See if a webform node should have a block visible for it
 * @returns true if the webform node id is listed in the webform_block table
 */
function webformblock_nodestatus($nid) {
  if (!$nid) { return false; }
  
  $match = db_result(db_query("SELECT nid FROM {webform_block} WHERE nid = %d", $nid));
  return $match == $nid ? true : false;
}


function webformblock_nodeapi(&$node, $op, $a3 = NULL, $a4 = NUL) { 
  switch ($op) {
    case 'load':
      $node->webform_addblock = webformblock_nodestatus($node->nid);
      break;
  
    case 'update':
      if ($node->webform_addblock == true) {
        $r = db_query("SELECT nid FROM {webform_block} WHERE nid = %d", $node->nid);

        // If the update fails it must be the first time for this node
        if (db_result($r) != $node->nid) {
          db_query("INSERT INTO {webform_block} SET nid = %d", $node->nid);
        }
      } else {
        db_query("DELETE FROM {webform_block} WHERE nid = %d", $node->nid);
      }
      break;
      
    case 'insert':
      if ($node->webform_addblock == true) {
         db_query("INSERT INTO {webform_block} SET nid = %d", $node->nid);
      }
      break;
      
    case 'delete':
      db_query("DELETE FROM {webform_block} WHERE nid = %d", $node->nid);
      break;
  }
}


/*
 * Exposes blocks to match any webforms which have been activated
 */
function webformblock_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $block = webformblock_list();
      break;
          
    case 'configure':
      return array('editnode' => array(
        '#type' => 'item',
        '#value' => l(t('Edit webform'), 'node/'.$delta.'/edit', array('query' => 'destination=admin/build/block/configure/webformblock/' . $delta) ),
      ));
      break;
          
    case 'view':
      $block = webformblock_view($delta);
      break;
  }
  
  return $block;
}


/*
 * Generate a list of blocks corresponding to webforms which have been ticked
 * to generate a block
 */
function webformblock_list() {
  $blocks = array();
  
  $wfb = db_query('SELECT n.title, n.nid FROM {webform_block} wfb LEFT JOIN {node} n ON wfb.nid = n.nid WHERE n.type = "webform" AND n.status = 1');
  while($block = db_fetch_object($wfb)) {
    $blocks[$block->nid] = array(
      'info' => t('Webform: @title', array('@title' => $block->title)),
      //'visibility' => '', // mark block not to show on same page as actual webform
      //'pages' => '', // need to get node path form db
      'cache' => BLOCK_CACHE_GLOBAL
    );
  }

  return $blocks;
}

/*
 * Use the block delta to load in the corresponding node and output as a block body
 * Block content can be themed as if it was a node-webform.tpl.php etc.
 */
function webformblock_view($nid) {
  $node = node_load(array('nid' => $nid));
      
  $block_subject = $node->title;
  $node->title = '';

  $anchorname = form_clean_id(str_replace('/', '', strtolower( drupal_get_path_alias('node/' . $node->nid) )));
  $node = node_view($node, false, false, false);
  
  $content = '<a name="'. $anchorname .'"></a>' . $node;

  $block = array(
    'subject' => $block_subject,
    'content' => $content,
  );

  return $block;
}
quicksketch’s picture

Status: Needs review » Fixed

All the functionality of Webform Block is now included in Webform 3.3. This module is no longer necessary.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.