Trying to use VBO within blocks to alter content of lists, like publishing, deleting. Whenever an action is taken it jumps right to the front page without executing anything.

Comments

jiria’s picture

Version: 7.x-3.x-dev » 7.x-3.0

Same problem here.
And if the block has an associated page in the view, then VBO jumps to that page.

Caligari-dupe’s picture

Identical problem here. I had a block with a VBO accessing a Rules Component Action Set. It worked this morning, then I updated to this new version, and since then every time I try to access it I an taken to the front page.

There are no errors or warnings in the log.

I'd argue that this bug makes VBOs largely unusable for me, so it might merit a higher status than "normal", but I'm new here, so I don't want to poke at things which others might have a better feel for.

In the meantime I'll have to go back to -RC1, I guess.

bojanz’s picture

How recent is your Views version? Can you check that you have the newest one?

I removed a workaround for blocks because the underlying issue got fixed in Views more than 6 months ago (if not during the previous year).
Your comments make me think that the workaround is still needed, while it shouldn't be.

This is the commit where I removed the workaround:
http://drupalcode.org/project/views_bulk_operations.git/commitdiff/e6141...

You can try reapplying that change manually, and see if that fixes it.

Louis Bob’s picture

Same issue here.
Views version: 7.x-3.5 (August 24, 2012).

stephenward’s picture

Same issue here using 7.x-3.0 from September 14th. As soon as I updated, all of my VBO blocks stopped working.

kenianbei’s picture

I'm using VBO in an embedded view in panels, also getting this bug.

Caligari-dupe’s picture

Just to followup, my Views is also 7.x-3.5

bojanz’s picture

Status: Active » Needs review
StatusFileSize
new683 bytes

Okay, please try this patch.

Caligari-dupe’s picture

I updated to the current version and verified that the actions were not working.

Then I applied that patch (two lines changed, basically just override_url -> override_path).

Testing again I was still unable to get the actions to complete, and I was taken back to the base site url. So no functional change, I'm afraid, at least for me.

Caligari-dupe’s picture

... However, I went ahead and added the other two lines from your previous backed out changes:

  // Quickfix for VBO & exposed filters using ajax. See http://drupal.org/node/1191928.
  $query = drupal_get_query_parameters($_GET, array('q'));
  $form['#action'] = url($vbo->view->get_url(), array('query' => $query));

And that immediately fixed all my problems, at least - my action set executed just fine.

Louis Bob’s picture

Hi Caligari,
could you explain exactly where you added these lines?
I could find
$query = drupal_get_query_parameters($_GET, array('q'));
in lines 515, 548 and 680 of the views_bulk_operations.module file.
So I added this line
$form['#action'] = url($vbo->view->get_url(), array('query' => $query));
just after each one of them, but VBO still doesn't work...

raphael apard’s picture

StatusFileSize
new921 bytes

Here a patch with #8 & #10.
Working for me

Louis Bob’s picture

Thanks for the patch in #12, it works just fine for me too.

Chaulky’s picture

I also had this issue when using VBO in a View embedded in a Panel like #6. Applied patch from #12 and it works again.

bojanz’s picture

Can we get a patch with just #10? And see if that fixes it? No need to commit more than necessary.

hernani’s picture

StatusFileSize
new580 bytes

Confirmed that what is mentioned in #10 works.

Here is a patch for it.

bojanz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

johnorourke’s picture

Issue summary: View changes

Just in case someone finds this issue is not fixed in all cases, as I did... The current (7.x-3.4) code still fails when a block display is the only or default display, and it's used in views_include_view, because the display handler is not an instance of the block handler.

I fixed it using a hook in my module:

/**
 * Implements hook_views_bulk_operations_form_alter
 */
function mymodule_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) {

  // VBO fails to set a URL when the default display of the view is block, compensate here
  // see https://www.drupal.org/node/1635146
  if (empty($vbo->view->override_url)) {
    if (empty($vbo->view->display_handler->display->display_options['path'])) {
      $vbo->view->override_url = $_GET['q'];
      $query = drupal_get_query_parameters($_GET, array('q'));
      $form['#action'] = url($_GET['q'], array('query' => $query));
    }
  }
}