That it. I think is because the hook is implemented with $cache['node'], and that just alter the form for nodes views kind only.

Thanks in advance.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alice Heaton’s picture

Ah, it probably does - I've never implemented non-node view filters, so I'll have to look into this.

laVera’s picture

may i help you? how?

Darren Oh’s picture

In the meantime, you can add a node relationship to get access to the filter.

laVera’s picture

Darren: Views don't let me do any relationship except user log.

I never did a drupal module, but i know some php, i did read all the code of this modules....and i'm so lost.

Now i think that views_or_views_data_alter() is not getting called, but i don't know where is supposed to be called when run ok.

Any ideas?

Darren Oh’s picture

We may have to duplicate the filters for every base table. As the module description says, this is an interim solution until Views core is modified.

P.S. You can do this yourself in the file views_or.views.inc. Look for the function views_or_views_data_alter():

function views_or_views_data_alter(&$cache) {
  $cache['node']['views_or_begin'] = array(
    'group' => t('Views Or'),
    'title' => t('Begin alternatives'),
    'help' => t('When using Views Or, this starts a section of alternatives'),
    'filter' => array(
      'handler' => 'views_or_handler_filter_begin_alternatives',
    ),
    'field' => array(
      'handler' => 'views_or_handler_field_begin_alternatives',
    ),
  );
  $cache['node']['views_or_next'] = array(
    'group' => t('Views Or'),
    'title' => t('Next alternative'),
    'help' => t('When using Views Or, delimitates an alternative with a begin alternatives/end alternatives block'),
    'filter' => array(
      'handler' => 'views_or_handler_filter_next_alternative',
    ),
  );
  $cache['node']['views_or_end'] = array(
    'group' => t('Views Or'),
    'title' => t('End alternatives'),
    'help' => t('When using Views Or, finishes a block of alternatives.'),
    'filter' => array(
      'handler' => 'views_or_handler_filter_end_alternatives',
    ),
    'field' => array(
      'handler' => 'views_or_handler_field_end_alternatives',
    ),
  );
}

Add copies of each $cache item with 'node' replaced with 'user':

  $cache['user']['views_or_begin'] = array(
    'group' => t('Views Or'),
    'title' => t('Begin alternatives'),
    'help' => t('When using Views Or, this starts a section of alternatives'),
    'filter' => array(
      'handler' => 'views_or_handler_filter_begin_alternatives',
    ),
    'field' => array(
      'handler' => 'views_or_handler_field_begin_alternatives',
    ),
  );
  $cache['user']['views_or_next'] = array(
    'group' => t('Views Or'),
    'title' => t('Next alternative'),
    'help' => t('When using Views Or, delimitates an alternative with a begin alternatives/end alternatives block'),
    'filter' => array(
      'handler' => 'views_or_handler_filter_next_alternative',
    ),
  );
  $cache['user']['views_or_end'] = array(
    'group' => t('Views Or'),
    'title' => t('End alternatives'),
    'help' => t('When using Views Or, finishes a block of alternatives.'),
    'filter' => array(
      'handler' => 'views_or_handler_filter_end_alternatives',
    ),
    'field' => array(
      'handler' => 'views_or_handler_field_end_alternatives',
    ),
  );
laVera’s picture

thanks, i did try it before ask here, and try now again (i can't remember if the first time i write user or users). But don't work.
I apretiate the help of all you.

As i have to had this working today, i just gona make a php page with the querry.

Once again, thanks to all of you.

meba’s picture

Status: Active » Needs review
FileSize
1.36 KB

Actually, it's "users", not "user". Attaching a patch.

Alice Heaton’s picture

@meba : Patch looks good.

@nahuel : Could you test the patch to make sure it works as expected ? I'll commit the patch once you confirm it works ;)

laVera’s picture

I'm not running that proyect anymore, and don't know how to patch (yet)

AlexisWilke’s picture

Title: filter don't show when using a view displaying items of type User. » filter doesn't show when using a view displaying items of type User or other types...
Status: Needs review » Reviewed & tested by the community
FileSize
1.35 KB

Hi Anselm,

I tested and it works for me. And as I was at it, I added aggregator_item since that's what I really needed 8-)

Thank you!
Alexis Wilke

Darren Oh’s picture

Status: Reviewed & tested by the community » Needs work

We're eventually going to need to duplicate this for every base table. It would be more efficient to do so automatically.

AlexisWilke’s picture

I guess it would be smart to have a sub-function that generates the array since only a few entries have to be added.

Now I'm not too sure what the best method would be since if I add a package such as padfile then I get no support for it either... unless I were to add one more entry to the array for padfiles as it is done in the view_or module.

Thank you.
Alexis Wilke

meba’s picture

Status: Needs work » Needs review

Alternative patch, using clever function to regenerate cache.

Darren Oh’s picture

No patch attached.

Darren Oh’s picture

Status: Needs review » Needs work

Nothing to review until patch is actually attached.

maksimk’s picture

Hello
seems that views_or does not support OR for arguments (user type view)
i have added this code to views_or_views_data_alter

  $cache['users']['views_or_begin'] = array(
    'group' => t('Views Or'),
    'title' => t('Begin alternatives'),
    'help' => t('When using Views Or, this starts a section of alternatives'),
    'filter' => array(
      'handler' => 'views_or_handler_filter_begin_alternatives',
    ),
    'field' => array(
      'handler' => 'views_or_handler_field_begin_alternatives',
    ),
    'argument' => array(
      'handler' => 'views_or_handler_argument_begin_alternatives',
    ),
  );
  $cache['users']['views_or_next'] = array(
    'group' => t('Views Or'),
    'title' => t('Next alternative'),
    'help' => t('When using Views Or, delimitates an alternative with a begin alternatives/end alternatives block'),
    'filter' => array(
      'handler' => 'views_or_handler_filter_next_alternative',
    ),
    'argument' => array(
      'handler' => 'views_or_handler_argument_end_alternatives',
    ),
  );
  $cache['users']['views_or_end'] = array(
    'group' => t('Views Or'),
    'title' => t('End alternatives'),
    'help' => t('When using Views Or, finishes a block of alternatives.'),
    'filter' => array(
      'handler' => 'views_or_handler_filter_end_alternatives',
    ),
    'field' => array(
      'handler' => 'views_or_handler_field_end_alternatives',
    ),
    'argument' => array(
      'handler' => 'views_or_handler_argument_end_alternatives',
    ),    
  );

but seems it does not work

it shows

Argument #2 is not an array in /home/www/balado_web/sites/all/modules/views_or/views_or_handler_argument.inc on line 142.
warning: Invalid argument supplied for foreach() in /home/www/balado_web/sites/all/modules/views_or/views_or_handler_argument.inc on line 142.

laVera’s picture

Status: Needs work » Closed (fixed)
meba’s picture

Category: support » feature
Status: Closed (fixed) » Needs work

Any reason to close this issue? It's still not fixed.

AlexisWilke’s picture

meba,

Where is your alternative patch? You never posted it!

Thank you.
Alexis Wilke

SocialNicheGuru’s picture

subscribing

Darren Oh’s picture

Status: Needs work » Closed (won't fix)

Since this module is just a temporary solution until Views core supports alternative blocks, you can use a relationship to get it to work with non-node object types, as pointed out in comment #3.

Darren Oh’s picture

Status: Closed (won't fix) » Needs review
FileSize
1.92 KB

Merlin explained how to make a global handler.

chromix’s picture

The patch itself didn't work but after applying it manually I was able to add Views_or logic to arguments on a User view without a problem...! Great work Darren Oh.

kenjil’s picture

Had the same trouble. Applied patch of Darren Oh and solved. Thanks. Would be nice if it could be included in 6.x-1.dev.

zdean’s picture

subscribe

adam_c’s picture

I applied the code in the patch and I get the arguments.

However, it is adding 'WHERE' to the end of every query and if there there are no filters then it forms an erroneous query which in turn returns nothing.

adam_c’s picture

I found that I can avoid this behaviour if 'next alternative' is not set to share arguments.

However, this is now causing problems as i need it to share the argument

jrz’s picture

I know its over a year ago, but I had the same problem until I cleared the Cache (#16).

elliotttf’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm the patch in #22 works for this purpose.

mikeytown2’s picture

I can also confirm the patch in #22 works!

Darren Oh’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in commit bf76e92. Thanks to everyone who reviewed this patch!

Status: Fixed » Closed (fixed)

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